Multiusers login redirect different page in php

113 views Asked by At

I want to redirect different web pages when after the registration of user.two type of user register in the system. But they are redirect into (conduct.php) page only.

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

There are 2 answers

0
عثمان غني On

You should use compairson operator i.e. ==

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

Hope it helps.

1
pavel On

Comparing in PHP is done by == or ===.

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

Or using else:

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