在sign_up之后重定向到另一个页面时出现会话错误

时间:2014-09-25 06:10:55

标签: php session

我正在尝试在会话变量" $ _ SESSION [' user_id']"中设置值,它在我的服务器端正常工作,但是当我上传它时客户端的服务器,然后它在该变量中显示空值。这是代码:

session_start();
if(isset($_POST['submit'])):
    $select="select email from credentials where email='".$_POST['email']."'";
    $select_run=mysql_query($select) or die(mysql_error());
    $select_num=mysql_num_rows($select_run);
    if($select_num > 0):
        $nok="Email Address already exists. Please choose another.";
    else:
        $date = date("Y-m-d",strtotime($_POST['dob']));
        $name = $_POST['fname']." ".$_POST['lname'];
        $query="insert into credentials(fullname,email,pass) values('$name','".$_POST['email']."',
        '".md5($_POST['pass'])."')";
        mysql_query($query) or die(mysql_error());
        $_SESSION['user_id'] = mysql_insert_id();
        $send_mail=$db->send_mail3($_POST['email'],$name);
        $ok="You are successfully registered";
        forceRedirectAdmin("booking_code.php");
    endif; 
endif;

当用户重定向到booking_code.php时,问题是$ _SESSION [' user_id']显示空值。

0 个答案:

没有答案