PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
ghadacr
Forum Contributor
Posts: 135 Joined: Fri May 11, 2007 10:44 am
Post
by ghadacr » Wed Aug 08, 2007 6:51 am
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...
superdezign
DevNet Master
Posts: 4135 Joined: Sat Jan 20, 2007 11:06 pm
Post
by superdezign » Wed Aug 08, 2007 8:23 am
Are the buttons sent as a GET request, or POST request?
ghadacr
Forum Contributor
Posts: 135 Joined: Fri May 11, 2007 10:44 am
Post
by ghadacr » Wed Aug 08, 2007 8:30 am
Thery are set at GET:
Code: Select all
<form action=http://www.some.com/check.php method="get">
ghadacr
Forum Contributor
Posts: 135 Joined: Fri May 11, 2007 10:44 am
Post
by ghadacr » Wed Aug 08, 2007 9:40 am
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.'');
}
?>