0

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");
 }

}  
?> 
pavel
  • 26,538
  • 10
  • 45
  • 61
Sandun Tharaka
  • 727
  • 2
  • 9
  • 29

2 Answers2

0

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.

عثمان غني
  • 2,786
  • 4
  • 52
  • 79
0

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");
}
pavel
  • 26,538
  • 10
  • 45
  • 61
  • You are using separate if condition for checking user type.There for both two condition are processing.It's not good practice @sandun tharaka. And also you are using wrong comparison operator.you have to use '==' operator for comparing. – Sandun Harshana Jul 01 '15 at 16:29