Gang67
|Jump out gang, we jump out those vehicles|
- May 5, 2017
- 303
- 54
It isn't sending the data to my database nor showing error messages
Code:
<?php
session_start();
//connect to database
$db=mysqli_connect("localhost","root","{DB PASSWORD}","rppp");
if(isset($_POST['register_btn']))
{
$username=mysql_real_escape_string($_POST['username']);
$email=mysql_real_escape_string($_POST['email']);
$password=mysql_real_escape_string($_POST['password']);
$password2=mysql_real_escape_string($_POST['password2']);
if($password==$password2)
{ //Create User
$password=md5($password); //hash password before storing for security purposes
$sql="INSERT INTO users(username,email,password) VALUES('$username','$email','$password')";
mysqli_query($db,$sql);
$_SESSION['message']="You are now logged in";
$_SESSION['username']=$username;
header("location:home.php"); //redirect home page
}
else
{
$_SESSION['errormessage']="The two password do not match";
}
}
?>
Code:
<div class="content">
<form method="post">
<input type="text" name="username" id="username" class="form" placeholder="Username"> <br /><br />
<input type="text" name="email" id="email" class="form" placeholder="Email"> <br /><br />
<input type="password" name="password" id="password" class="form" placeholder="Password"> <br /><br />
<input type="password" name="password2" id="password2" class="form" placeholder="Verify Password"> <br /><br />
<input type="submit" name="register_btn" id="register_btn" class="submit">
</form>