<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$dbname = 'moviefone';
$con = mysql_connect($dbhost, $dbuser, $dbpass) or die ('can not connect to the database');
mysql_select_db($dbname, $con);
if (!empty($_POST['usernamesignup']) && !empty ($_POST['emailsignup']) && !empty($_POST['passwordsignup'])
&& !empty($_POST['passwordsignup']) && !empty($_POST['passwordsignup_confirm']))
{
$email = $_POST['emailsignup'];
$username = $_POST['usernamesignup'];
$password = $_POST['passwordsignup'];
$sql ="INSERT INTO users (email,username, password) VALUES ('$email', $username','$password')";
$result = mysql_query($sql);
if ($result) {
echo "you have registered successfully";
}
else {
echo "there was a problem";
}
}
else {
echo "Please confirm your information";
}
?>
Here's html code
<div id="register" class="animate form">
<form action="signup_ac.php" autocomplete="on" method="POST">
<h1> Sign up </h1>
<p>
<label for="usernamesignup" class="uname" data-icon="u">Your username</label>
<input id="usernamesignup" name="usernamesignup" required type="text" placeholder="mysuperusername690" />
</p>
<p>
<label for="emailsignup" class="youmail" data-icon="e" > Your email</label>
<input id="emailsignup" name="emailsignup" required type="email" placeholder="mysupermail@mail.com"/>
</p>
<p>
<label for="passwordsignup" class="youpasswd" data-icon="p">Your password </label>
<input id="passwordsignup" name="passwordsignup" required type="password" placeholder="eg. X8df!90EO"/>
</p>
<p>
<label for="passwordsignup_confirm" class="youpasswd" data-icon="p">Please confirm your password </label>
<input id="passwordsignup_confirm" name="passwordsignup_confirm" required type="password" placeholder="eg. X8df!90EO"/>
</p>
<p class="signin button">
<input type="submit" value="Sign up"/>
</p>
<p class="change_link">
Already a member ?
<a href="#tologin" class="to_register"> Go and log in </a>
</p>
</form>
</div>
I have made a simple registration form to test if its working.But when I try to open registration.php it only displays please confirm your information
.there are two page for html registration.php and for php signup_ac.php. I do not understand why.If the problem is with my php then it should display the form I think .
You need to learn to debug your code:
if [...snip...] $POST_['passwordsignup_confirm'])){
^^^^^--- dyslexic moment?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.