Page 1 of 1

Not redirecting

Posted: Wed Aug 08, 2007 6:51 am
by ghadacr
I got a form which has two buttons, lets say if confirmed is pressed then it gets redirected to page 1, if release gets pressed it gets redirected to page 2....

The problem i'm having is that it does not redirect to the appropiate page:

Here is the code:

Code: Select all

<?PHP 
$Confirm   = $_GET['Confirm']; 
//$Release   = $_GET['Release']; 

if (!isset($_GET['Confirm'])) { 
header('Location: http://www.some.com/conaddops.php');

} 



?>

Thanks in advance...

Posted: Wed Aug 08, 2007 8:23 am
by superdezign
Are the buttons sent as a GET request, or POST request?

Posted: Wed Aug 08, 2007 8:30 am
by ghadacr
Thery are set at GET:

Code: Select all

<form action=http://www.some.com/check.php method="get">

Posted: Wed Aug 08, 2007 8:47 am
by superdezign
Tell me what this results in:

Code: Select all

print_r($_GET);

Posted: Wed Aug 08, 2007 9:40 am
by ghadacr
I got it kind of working, if i press the release but it works, but if i press the confirm button i get the following error:
Notice: Undefined index: Release in C:\check.php on line 8
i did your print_r($_GET) and i got the following:

Code: Select all

Array ( [AvailableFrom] => 22 Aug 2007 0:00 [HotelRoomID] => 200 [Confirm] => Confirm )

Code: Select all

<?PHP

//print_r($_GET);

$HotelRoomID = $_GET['HotelRoomID'];
$AvailableFrom = $_GET['AvailableFrom'];
$Confirm   = $_GET['Confirm'];
$Release   = $_GET['Release'];

if (!isset($_POST['Confirm']) && !empty($_POST['Confirm'])) {

header('Location: http://conaddops.php?HotelRoomID='.$Hot ... bleFrom.'');

} elseif ((!isset($_POST['Release']) && !empty($_POST['Release']))) {

header('Location: http://releaseaddops.php?HotelRoomID='. ... bleFrom.'');

}
?>