这段代码仍然无法正常工作。提交按钮没有做任何事情,当我点击它。有人可以告诉我我哪里出了问题。因为我只是改变了一些HTML/CSS代码引导,并没有改变任何变量或PHP代码。登录/登录页面引导php
<?php
// Assign varibles
$submit = @$_POST['submit'];
//variables to prevent errors
$account = "";
$gender = "";
$name = "";
$email = "";
$password = "";
$password2 = "";
$u_check = "";
//reg form
$account = strip_tags(@$_POST['account']);
$gender = strip_tags(@$_POST['gender']);
$fullname = strip_tags(@$_POST['fullname']);
$email = strip_tags(@$_POST['email']);
$password = strip_tags(@$_POST['password']);
$password2 = strip_tags(@$_POST['password2']);
// will insert the data when the user presses the submit button.
// query will insert data into the database.
if ($submit){
//check if user email already exists
$u_check = mysqli_query ($connect,"SELECT email FROM users WHERE email ='$email' ");
// count the amount of rows where e-mail = $email
$check = mysqli_num_rows($u_check);
if ($check == 0) {
//all fields have been filled in
if ($account&&$gender&&$name&&$email&&$password&&$password2){
//if (!empty($account) && !empty($gender) && !empty($name) && !empty($email) && !empty($password) && !empty($password2)){
//Password Match
if ($password==$password2) {
//Validation to check the max length of name is 25 characters
if (strlen($name)>25) {
echo "You have exceed the max characters length for your name.";
}
else
{
//check length of password - cant be more than 25 and less than 6 characters.
if(strlen($password)>25 ||strlen($password)<6) {
echo "You password has to be between 6 and 25 characters long";
}
else {
//encrypt password
$password = md5($password);
$password2 = md5($password2);
//insert registeration data on the DB
$reg_query = mysqli_query ($connect, "INSERT INTO users VALUES ('','$fullname','$email','$gender','$password','$password2','','$account','no','')");
die("<h3>Welcome to MyAstonSpace</h3>Login to your account to get started...");
}
}
}
else {
echo "Your passwords do not match. Try Again!";
}
}
else {
echo "Please complete all the form to register.";
}
}
else {
echo "E-mail already registered. Try Again!";
}
}
?>
<div class="container" style="position:absolute; top: 175px; left: 400px; ">
<div class="row-fluid">
<div class="col-md-12">
<div class="col-md-6">
<div class="area">
<div class="heading">
<h1>Sign Up</h1>
</div>
<br/>
<form action="#" method="POST" enctype="multipart/form-data" >
<div class="controls" style="font-size:16px">
<center>
<label class="radio-inline">
<input type="radio" name="account"> Student</label>
<label class="radio-inline">
<input type="radio" name="account"> Landlord
</label>
</center>
</div>
<br/>
<div class="controls" style="font-size:16px">
<center>
<label class="radio-inline">
<input type="radio" name="gender"> Male</label>
<label class="radio-inline">
<input type="radio" name="gender"> Female</label>
</form>
</center>
</div>
<br/>
<div class="form-group">
<label for = "fullname"> Full Name: </label>
<input type="text" name="fullname" class="form-control" required/> <br/>
<label for = "email"> Email: </label>
<input type="email" name="email" class="form-control" pattern="[A-Za-z0-9._%+-][email protected]" required/> <br/>
<label for = "password"> Password: </label>
<input type="text" name="password" class="form-control" required/><br/><br/>
<label for = "password2"> Retype Password: </label>
<input type="text" name="password2" class="form-control" required/><br/><br/>
</div>
By clicking Sign Up, you agree on our <a href="#">terms and condition</a>. <br/><br/>
<input type="submit" class="btn btn-sucess" name="submit" value="Sign Up" style="background-color:#337AB7; color:white;">
</form>
</div>
</div>
</div>
这段代码仍然不起作用。提交按钮没有做任何事情,当我点击它。有人可以告诉我我哪里出了问题。因为我只是改变了一些HTML/CSS代码引导,并没有改变任何变量或PHP代码。 –
hi @ Aman.V,你的意思是说php没有问题?问题是与HTML/CSS! – ameenulla0007
您之前提到过,它需要您每次输出('请填写所有表格以进行注册')。 – ameenulla0007