多用户登录重定向php中的不同页面

时间:2015-06-08 10:45:39

标签: php

我想在系统注册user.two类型的用户注册后重定向不同的网页。但他们只是重定向到(conduct.php)页面。

register.php

<?php

//session_start();
include('connect.php');

if(isset($_POST['submit'])){

extract($_POST);

var_dump($_POST);

$mysql_query = mysql_query("INSERT INTO  `iportal`.`signup` (
                                        `registation_no` ,
                                        `name` ,
                                        `batch` ,
                                        `stream` ,
                                        `email` ,
                                        `username` ,
                                        `password` ,
                                        `isuser`
                                        )
VALUES (
'$registrationnumber',  '$fullname',  '$batch',  '$stream',  '$email',  '$username',  '$password',  '$isUser'
)
"); 

 if($isUser=0){

    header("Location: practical.php");
  }

if($isUser=1){

  header("Location: conduct.php");
 }

}  
?> 

2 个答案:

答案 0 :(得分:0)

您应该使用compairson运算符,即==

if($isUser==0){ //correct it
    header("Location: practical.php");
}
if($isUser==1){  //correct it
    header("Location: conduct.php");
}

希望它有所帮助。

答案 1 :(得分:0)

PHP中的比较由=====完成。

if ($isUser == 0) {
    header("Location: practical.php");
} elseif ($isUser == 1) { 
    header("Location: conduct.php");
}

或使用else

if ($isUser == 0) {
    header("Location: practical.php");
} else {
    header("Location: conduct.php");
}