insert IF issue
Posted: Fri Feb 26, 2010 5:40 am
I have an if statement where I want an insert statement to run only if one variable equals another variable, ie. they have to be identical.
However the information isn't being passed into my database.
However the information isn't being passed into my database.
Code: Select all
<?php
include("connection.php");
$username = $_POST['newuser'];
$password = $_POST['newpass'];
$password2 = $_POST['newpasscheck'];
if ($password == $password2) {
$sql = sprintf("INSERT INTO userdetails (username, password, userlevel, joindate) VALUES ('$username', md5
('$password'), 'Member', curdate()) ",
mysql_real_escape_string($username),
mysql_real_escape_string($password));
echo $sql;
/*echo "<head><meta HTTP-EQUIV='REFRESH' content='00; url=profile.php'></head>";*/
}
else {
echo "your passwords did not match";
/*echo "<head><meta HTTP-EQUIV='REFRESH' content='5; url=index.php'></head>";*/
}
?>