我使用wamp服务器php我的admin sql,表创建的连接每件事情都很好,我在本地主机上工作,但是再次页面获取加载,不移动光标等,自动提交按钮点击?
这是屏幕截图http://i.imgur.com/QC6RtAg.jpg?1
<center><form method="post">
<table border="0" cellspacing="8">
<tr>
<td><label><b>*Select Campus:</b></label></td>
<td>
<select name="city" id="city">
<option value="">-Please Select-</option>
<option value="Isb">Islamabad</option>
<option value="Abt">Abbotabad</option>
<option value="wah">Wah</option>
<option value="Atk">Attock</option>
<option value="shw">Sahiwal</option>
<option value="veh">Vehari</option>
<option value="vir">Virtual</option>
</select>
<font color="red"><?php echo @$_GET['campus'];?></font>
</td>
</tr>
<tr>
<td><label><b>*Name</b></label></td>
<td><input type="text" name="name" />
<font color="red"><?php echo @$_GET['newname'];?></font>
<td></tr>
<br/>
<tr>
<td><label><b>*Login</b></label></td>
<td><input type="text" name="logid"/>
<font color="red"><?php echo @$_GET['logname'];?></font>
<td></tr>
<br/>
<tr>
<td><label><b>*Email Address</b></label></td>
<td><input type="text"type="require" name="email"/>
<font color="red"><?php echo @$_GET['emailname'];?></font>
</td></tr>
<br/>
<tr>
<td><label><b>*Password</b></label></td>
<td><input type="password" type="require" name="pass"/>
<font color="red"><?php echo @$_GET['passname'];?></font>
</td></tr>
<br/>
<tr>
<td><label><b>*Retype Password</b></label></td>
<td><input type="password" type="require" name="rpass"/>
<font color="red"><?php echo @$_GET['rpassname'];?></font>
</td></tr>
</table>
<table border="0">
<tr id="bu">
<td ><input type="submit" id="cl" value="sign up"name="submit"/></td> </tr>
</table>
</form>
</center>
<?php
$conn = mysqli_connect('localhost', 'root' , '','example');
if(isset($_POST['submit']))<?php
{
$campus=$_POST['city'];
$name = $_POST['name'];
$u_id = $_POST['logid'];
$email = $_POST['email'];
$pass = $_POST['pass'];
$rpass = $_POST['rpass'];
if($campus==''){
echo
"<script>window.open('Log.php?campus=Select campus is Required','_self')
</script>";
exit();
}
if($name==''){
echo
"<script>window.open('Log.php?newname=Name is Required','_self') </script>";
exit();
if($u_id==''){
echo
"<script>window.open('Log.php?logname=User ID is Required','_self')</script>";
exit();
}
if($email==''){
echo
"<script>window.open('Log.php?emailname=Email is Required','_self') </script>";
exit();
}
if($pass==''){
echo
"<script>window.open('Log.php?passname=Password is Required','_self') </script>";
exit();
}
if($rpass==''){
echo
"<script>window.open('Log.php?rpassname=Password is Required','_self') </script>";
exit();
}
$sql = "INSERT INTO student(Campus,User_id,Login,Email,password,Retype_password) values('$campus','$name','$u_id','$email','$pass','$rpass')";
if (mysqli_query($conn,$sql) {
echo "New record created successfully";
print '<script>alert("Successfully Registered!");</script>'; // Prompts the user
print '<script>window.location.assign("login.php");</script>'; // redirects to register.php
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}$conn->close();
}
?>