html/php form help..?
- Started
- Last post
- 6 Responses
- cosmo0
use if statement like undoundo mentioned.
I personally prefer switch statements:
switch ($_POST['id4'])
{
case 2:
header ("Location: page2.php");case 4:
header ("Location: page2.php");
}
- ldww0
cosmo, aren't you missing "break;" after each case?
i also find switch statements to be cleaner.
also, as a good rule, i like to put exit; after each header location just as a safe gaurd. sometimes it can execute code after the header before it actually redirects.
- cosmo0
aahh yes, I did miss the breaks. ldww good catch.
yes, switch statements are a lot cleaner.
- scpgt0
grand.
thanks kindly for the help people.. shall give it a whizz in a bit.
- determinedmoth0
also, as a good rule, i like to put exit; after each header location just as a safe gaurd. sometimes it can execute code after the header before it actually redirects.
ldww
(Feb 13 06, 07:27)True that as I learnt the hard way.
- UndoUndo0
if($_POST['id4']=="2"){
header("Location: www.example.com/page1.php")…
} else{
header("Location: www.otherexample.com/page2.php...
}