i have made the form action a variable..ie code echo the 1.php if registration values have been set by the user accordingly....and register.php if user have entered some improper values.
then i save these values in session variables and call these variables on 1.php to enter in the database.

my problem

when the user enter the values for first time and clicks submit ..he is returned on register.php instead of 1.php ....then if user again fills the register page it sends to 1.php(ie it doesnt work on first place) and next weird thing is that the session variables keep the values entered during the first time and saves htese to database........
i m not able to get it right.......

Recommended Answers

All 4 Replies

Sounds like a mess. Post your code

///////before this get the values from fields///
if($name==$x)
	{
	$msg= "user name already in use. select different user name";
	}
else
{
$_SESSION['x']= $x;
 $_SESSION['y']= $y;
 $_SESSION['w']= $email;
 $_SESSION['q']= $eaddress;
 $yet='1.php';//for form action
 }
}
else
{
$msg= "passwords do not match";
$yet='register.php';
}
 
}
else
{
$msg="incorrect email address format";
$yet='register.php'
}
 }
else
{
$msg= "fill out all the fields";
$yet='register.php'
}
  }
  ###############################################################################################################
?>

<body>


<div class="ta">
<h2>Do not leave any blank fields. All fields are compulsory. </h2>
<div class="regi_err">
  <?PHP #################################################  error message  ##########################################
echo $msg;
 ?>
</div>
<form id="form1" name="form1" method="post" action="<?php echo $yet;?>">####here i set the form action#
  <table width="250" height="120" border="0" cellpadding="1" cellspacing="1">
    <tr>
      <td width="150" scope="col"><label>username </label></td>
      <th width="100" height="20" scope="col"><input name="fuckx" type="text" id="fuckx" /></th>
    </tr>
    <tr>
      <td width="150">password </td>
      <td width="100" height="20"><input name="pass" type="password" id="pass" /></td>
    </tr>
    <tr>
      <td width="150"><label>verify password </label>
      <label></label></td>
      <td width="100" height="20"><input name="passv" type="password" id="passv" /></td>
    </tr>
    <tr>
      <td width="150"><label>address</label></td>
      <td width="100" height="20"><input name="eaddress" type="text" id="eaddress" /></td>
    </tr>
    <tr>
      <td width="150"><label>email </label></td>
      <td width="100" height="20"><input name="email" type="text" id="email" /></td>
    </tr>
    <tr>
      <td width="150">&nbsp;</td>
      <td width="100" height="20">&nbsp;</td>
    </tr>
  </table>
  <span class="style1">
  <label></label>
  </span>
  <p>
    <label></label>
    <input name="register" type="submit" id="register" value="register" />
  </p>
  
  

</form>

There are so many extra }. You need to post your complete code because this code doesnt make much sense.

There are so many extra }. You need to post your complete code because this code doesnt make much sense.

the code is running fine only problem is with the form action ......which i m setting thru variable(set).........it works the second time i run the page.....and session variables are that of previous attempt (ie i have to register twice.......)

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.