当我按下提交按钮时,为什么不显示消息或if语句有效?

时间:2016-10-21 21:02:54

标签: php html mysql css

我的代码:

<?PHP

session_start();
$db = mysqli_connect("127.0.0.1", "root", "root", "Authentication");



if(isset($_POST['sbtn'])){
    session_start();
$f_name = mysql_real_escape_string($_POST['f_name']);
$l_name = mysql_real_escape_string($_POST['l_name']);
$email = mysql_real_escape_string($_POST['email']);
$pass = mysql_real_escape_string($_POST['pass']);
$c_pass = mysql_real_escape_string($_POST['c_pass']);

if($pass == $c_pass){
    //create user
    $pass = md5($pass);
    $sql = "INSERT INTO users(email, password, f_name, l_name) VALUES($email, $pass, $f_name, $l_name)";
    mysqli_query($db, $sql);
    $_SESSION['message'] = "You are now registered welcome to UNDERLINE";
    $_SESSION['name'] = $f_name;
}else{
    //tell user they are not equal
    $_SESSION['message'] = "The two passwords did not match";
}
}

mysqli_close($db);
?>

此代码由于某种原因不允许我将信息添加到数据库中,它也不会显示我的会话消息

0 个答案:

没有答案