If condition for moving to another page - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

If condition for moving to another page

newphpcodernewphpcoder Posts: 21Member
Good day!

I want to know what is wrong in my code that's why when i choose in select option it did not go to another page...Like when I select "Incoming" nothing happen also when I choose "Outgoing" nothing also happen.

Here is my code:

[code]
<?php
include ("config.php");

$call_type = $_POST['call_type'];

$query=mysql_query("SELECT `call_type` FROM `tbl_calltype` WHERE `call_type` = '{$call_type}'") or die(mysql_error());
$result = mysql_num_rows($query);

if ($result == 1){

if($call_type == 'Incoming'){
header ('Location:incoming.php');
}
elseif($call_type == 'Outgoing'){
header ('Location:outgoing.php');
}
else{
header('Location:index.php');
}
}
?>




Select Call Type
>Incoming
>Outgoing




[/code]

Thank you

Comments

  • pseudocoderpseudocoder Posts: 690Member ✭✭✭
    header() is a really picky function; if you have any browser output at all before calling it, you won't get anything - that includes any files that you "require" or "include". Check that first.

    Another thing to try is the identity operator. if($call_type === 'Incoming') { ... }

    One last thing is try outputting a string of some kind from within your if/else if/else structure. If you see your output, then header() is *probably* not liking something - browser output, stray new line at the end of a file, etc.
Sign In or Register to comment.