zero-perfoliate
zero-perfoliate

Author Topic: self processing form page is not working HELP!!  (Read 679 times)

Offline sardonic

  • New PHP Members
  • Posts: 1
  • Karma: +0/-0
self processing form page is not working HELP!!
« on: May 14, 2008, 12:52:36 AM »
Hey folks,

Before I start implementing a real log-in page, I'm trying to get my self processing form to check for empty fields. Instead, the empty form keeps getting returned whether the fields were filled or not.  I changed the form to use GET so I can see all the parameters for the time being.  Upon submission, I can see the paramters being carried through, but it's like the logic checks are being ignored and the form re-renders.  So according to this code, if the form is missing information, an error should be thrown, otherwise echo success.  Why isn't it working???

<?php
$in_name = $_GET["name"];
$in_pass = $_GET["pass"];


if (isset($_GET["submit"]))
{
   if ((!isset($in_name))||(!isset($in_pass)))
   {
      ?>
      <p><font color="red>"Oops ...you did not fill out all your user credentials</font></p>
      <?php
   }
   else
      echo "success";
}
else
{ // if page is not submitted to itself echo the form
?>

<form action="<?php echo $PHP_SELF;?>" method="GET" id="identity">
<p>Please Login</p>
<p>&nbsp;<label for="userName">Username: <input type="text" size="20" maxlength="20" id="userName" name="name"/></label></p>
<p>&nbsp;<label for="password">Password: <input type="text" size="10" maxlength="10" id="password" name="pass"/></label></p>
<p>New User? Click <a href="new.php">Here[/url]</p>
<p><center><input type="submit" value="submit"></center></p>
</form>

<?php
}