Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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');
}
}
?>







[/code]

Thank you

Comments

  • pseudocoderpseudocoder Posts: 673Member ✭✭
    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.