我有一个简单的问题,但我不知道如何克服它。
这是我的页面,其中包含表单
<div id="register">
<table border="0" cellpadding="0" cellspacing="0" align="center" width="1000px" >
<tr>
<td height="300px" width="300px" align="center">
</td>
<td height="300px" width="400px" align="center" background="Images/panel2.png">
<form action="reg_conn.php" method="post">
<FIELDSET>
<LEGEND>Register</LEGEND><P>
<table width="350px" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td align="center" width="50px"/>
<td align="center" width="100px">
<label for="username" >UserName:</label>
</td>
<td align="center" width="50px"/>
<td align="center" width="100px">
<input type="text" name="username" class="textfield"/>
</td>
<td align="center" width="50px"/>
</tr>
<tr>
<td colspan="5" align="center" height="10px"/>
</tr>
<tr>
<td align="center" width="50px"/>
<td align="center" width="100px">
<label for="name" >Name:</label>
</td>
<td align="center" width="50px"/>
<td align="center" width="100px">
<input type="text" name="name" class="textfield"/>
</td>
<td align="center" width="50px"/>
</tr>
<tr>
<td colspan="5" align="center" height="10px"/>
</tr>
<tr>
<td align="center" width="50px"/>
<td align="center" width="100px">
<label for="email" >Email:</label>
</td>
<td align="center" width="50px"/>
<td align="center" width="100px">
<input type="text" name="email" class="textfield"/>
</td>
<td align="center" width="50px"/>
</tr>
<tr>
<td colspan="5" align="center" height="10px"/>
</tr>
<tr>
<td align="center" width="50px"/>
<td align="center" width="100px">
<label for="password" >PassWord:</label>
</td>
<td align="center" width="50px"/>
<td align="center" width="100px">
<input type="password" name="password" class="textfield"/>
</td>
<td align="center" width="50px"/>
</tr>
<tr>
<td colspan="5" align="center" height="10px"/>
</tr>
<tr>
<td align="center" width="50px"/>
<td align="center" width="100px">
<label for="security_q" >Security Question:</label>
</td>
<td align="center" width="50px"/>
<td align="center" width="100px">
<select name="security_q" class="dropdown" style="width: 100px" >
<option value="My 1st Teacher">My 1st Teacher</option>
<option value="My 1st Pet">My 1st Teacher</option>
<option value="My 1st Crush">My 1st Crush</option>
</select>
</td>
<td align="center" width="50px"/>
</tr>
<tr>
<td colspan="5" align="center" height="10px"/>
</tr>
<tr>
<td align="center" width="50px"/>
<td align="center" width="100px">
<label for="security_a" >Security Answer:</label>
</td>
<td align="center" width="50px"/>
<td align="center" width="100px">
<input type="text" name="security_a" class="textfield"/>
</td>
<td align="center" width="50px"/>
</tr>
<tr>
<td colspan="5" align="center" height="10px"/>
</tr>
<tr>
<td align="center" width="50px"/>
<td align="center" width="250px" colspan="3">
<input type="submit" class="button" style="width: 200px; height: 20px;" />
</td>
<td align="center" width="50px"/>
</tr>
</table>
</FIELDSET>
</form>
</td>
<td height="300px" width="300px" align="center"/>
</tr>
</table>
</div>
我的reg_conn.php文件如下:
<?php
include('connection.php');
$sql="INSERT INTO candidate_register_table (username, name, email, password, security_q, security_a)
VALUES
('$_POST[username]','$_POST[name]','$_POST[email]','$_POST[password]','$_POST[security_q]','$_POST[security_a]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con);
?>
现在,当我提交时,页面被重定向到reg_conn.php文件。我不想这样;我想停留在前一页。如何做到这一点?
https://stackoverflow.com/questions/9338195
复制相似问题