I have a page1.php which is a form and i want to be able to go to page2.php when i click submit in page1.php.?
How do i do that ...my page1.php is a self processing form.


this is what i have now...

<form action="<?php echo $_SERVER?>" method="post"> - this is sending data to the database but not the one below

I tried the one as below as well but no use.

<form action="page2.php" method="post">

but not working...

can you check whether form tags are closed corrected or not.
also can you post code here?

can you check whether form tags are closed corrected or not.
also can you post code here?

Below is the code...thanks much for the help

<?php
session_start();
?>

<head>

<title>#*$!xx</title>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<link href="CSS/program.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 ¦¦ p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min ¦¦ max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
} }
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<br>
<?php

$db_host = "localhost";
$db_user = "#*$!xx";
$db_pwd = "#*$!#*$!";
$db_name = "#*$!#*$!";
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);

?>

<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post" >

<table width=1000 border="0" align="center" cellpadding=3 cellspacing="0" style="border:1px solid #999999;">
<tr>
<td height="30" colspan="2" valign="middle" bgcolor="#FF933" class="BodyTextHeaders">User Login / Registration</td>
</tr>
<?php
if (!isset($_POST['submit'])) {
?>
<tr>
<td width=200 valign="middle" bgcolor="#E8E8E8" class="BodyText"><strong>Username
:</strong></td>
<td width="786" valign="top" bgcolor="#E8E8E8" class="BodyText">


<input name="Username" type="text" class="BodyText" id="Username" value="Enter email address" size="50"></td>
</tr>

<tr>
<td width=200 valign="middle" class="BodyText"><strong>Password :</strong></td>
<td valign="top" class="BodyText"><p>
<label></label>
<input name="Password" type="password" id="Password" size="50">
</p></td>
</tr>

<tr>
<td valign="middle" bgcolor="#E8E8E8" class="BodyText" ><strong>Password
Assistance Question :</strong></td>
<td valign="bottom" bgcolor="#E8E8E8" class="BodyText" ><p>
<input name="PasswordQuestion" type="text" id="PasswordQuestion" size="50">
</p></td>
</tr>

<tr>
<td valign="middle" class="BodyText"><strong>Password Assistance Answer :</strong></td>
<td valign="bottom" class="BodyText"><p>
<input name="PasswordAnswer" type="text" id="PasswordAnswer" size="50">
</p> </td>
</tr>

<tr>
<td valign="middle" bgcolor="#E8E8E8" class="BodyText">&nbsp;</td>
<td valign="top" bgcolor="#E8E8E8" class="BodyText"><p><a href="#">Forgot Password</a> ¦ <a href="#">Help</a></p>
<p>Please keep your Password confidential. You will need it to access the following
online facilities related to this application :</p>
<ul>
<li >Online Status Enquiry</li>
<li >Online Change of Contact Details</li>
<li >Online Reply to CQT Offer</li>
</ul></td>
</tr>

</table>

<p align="center">
<input name="submit" type="submit" class="BodyText" onClick="MM_validateForm('Username','','RisEmail','Password','','R','PasswordQuestion','','R','PasswordAnswer','','R');return document.MM_returnValue" value="Next">
<input name="submit" type="submit" class="BodyText" value="Submit" onClick="MM_validateForm('Username','','RisEmail','Password','','R','PasswordQuestion','','R','PasswordAnswer','','R');return document.MM_returnValue" >
<input name="reset" type="reset" class="BodyText" value="Clear Form">
</p>

</form>
<?php
}
else {
$Username = $_POST['Username'];
$Password = $_POST['Password'];
$PasswordQuestion = $_POST['PasswordQuestion'];
$PasswordAnswer = $_POST['PasswordAnswer'];

mysql_query("INSERT INTO `PersonnelDetails` (Username, Password, PasswordQuestion, PasswordAnswer) VALUES ('$Username', '$Password', '$PasswordQuestion','$PasswordAnswer')");

}

?>

<p align="center">1/12</p>
</body>
</html>
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.