i need to validate my username and must not be blank..
i use this code..
but its not working...
i'm getting this error..
'Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster. "

please help me...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <meta http-equiv="Expires" content="Wed, 01 Jan 2020 00:00:01 GMT" />
      <meta http-equiv="X-UA-Compatible" content="IE=edge" />
      <meta http-equiv="Content-Script-Type" content="text/javascript" />
      <meta name="description" content="TBCNA" />
      <title>ContractManagement_1 - Main_Login</title>
	  <script type="text/javascript"> 
	  function checkForm(form) 
	  { 
	  if(form.txtusername.value == "") 
	  { 
	  alert("Error: Username cannot be blank!"); 
	  form.username.focus();
	  return false; 
	  }
	  if(form.txtpassword.value == "") 
	  { 
	  alert("Error: Password cannot be blank!"); 
	  form.username.focus();
	  return false;
	  }
	  }
	  </script>
    <script>
      function closeMe()
      {
      var win=window.open("","_self");
      win.close();
      }
      </script>
     <script>
     function redirectPage()
     {
       window.location = "login_help.php";
     }
     </script>
    </head>
    <body>
      <div id="s-9395579f-8d99-4532-9aba-597c3123fb3f">
        <input id="screenName" type="hidden" value="Main_Login" />
        <input id="canvases" type="hidden" value="s-9395579f-8d99-4532-9aba-597c3123fb3f?t-54111db7-a054-4a0b-a1aa-0177946a18ee" />
        <link type="text/css" rel="stylesheet" href="/brando/css/screens/Main_Login.css" charset="UTF-8" />
        <link type="text/css" rel="stylesheet" href="/brando/css/templates/Template 1.css" charset="UTF-8" />
        <div class="t-54111db7-a054-4a0b-a1aa-0177946a18ee template trigger commentable">
        </div>
        <div class="s-9395579f-8d99-4532-9aba-597c3123fb3f screen trigger commentable">
          <div id="s-Group_2">
            <div id="s-Rectangle_1" class="rectangle trigger commentable" ></div>
            <div id="s-Rectangle_2" class="rectangle trigger commentable" ></div>
            <img id="s-Image_1" class="image trigger commentable"   alt="image" src="/brando/images/0- stratechon clear logo-01.png" />
            <div id="s-Line_1" class="line trigger commentable" ></div>
            <div id="s-Line_2" class="line trigger commentable" ></div>
            <div id="s-Label_1" class="label trigger commentable" >Enterprise Management Tool</div>
            <div id="s-Label_4" class="label trigger commentable" >Copyright © Stratechon, Inc. 2011</div>
           <form name="frm" method="post" action="check_user.php onSubmit="return checkForm(this);">
            <input id="txtusername" class="input trigger commentable" type="text" maxlength="100" name="txtusername"  />
            <input id="txtpassword" class="input trigger commentable" type="password" maxlength="100" name="txtpassword"  />
            <div id="s-Label_5" class="label trigger commentable" >Login Name:</div>
            <div id="s-Label_6" class="label trigger commentable" >Password:</div>

            <div class="label trigger commentable"><input  id="s-Button_1" type="submit" name="sub" value="Log in"></div>
            <?php
                session_start();
                if (isset($_SESSION['error'])) {
                    echo '<div id="error" class="label trigger commentable">' . $_SESSION['error'] . '</div>';
                    unset($_SESSION['error']);
                }
                if (isset($_SESSION['error1'])) {
                    echo '<div id="error1" class="label trigger commentable">' . $_SESSION['error1'] . '</div>';
                    unset($_SESSION['error1']);
                }
                if (isset($_SESSION['error2'])) {
                    echo '<div id="error2" class="label trigger commentable">' . $_SESSION['error2'] . '</div>';
                    unset($_SESSION['error2']);
                }
                if (isset($_SESSION['error3'])) {
                    echo '<div id="error3" class="label trigger commentable">' . $_SESSION['error3'] . '</div>';
                    unset($_SESSION['error3']);
                }
            ?>  
          </form>
            <div class="label trigger commentable"><input id="s-Button_2" type="button" value="Close " onclick="closeMe()"></div>
            <div class="label trigger commentable"><input id="s-Button_3" type="button" value=" Help " onclick="redirectPage()"></div>
            <div id="s-Label_8" class="label trigger commentable" >Version 1.0.2</div>
            <div id="s-Group_1">
              <div id="s-Label_2" class="label trigger commentable" >BRANDO</div>
              <div id="s-Label_3" class="label trigger commentable" >international</div>
            </div>
          </div>
        </div>
      </div>
    </body>
  </html>
Member Avatar for diafol

have you tried the js forum? This is js not php.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.