Page 1 of 1

handling forms in the same page

Posted: Wed Mar 04, 2009 4:20 pm
by ofir0803
Hi

I have a menu and i want each link on the menu to go to the same page in a different id.
like:

Code: Select all

 
button1 : http://www.mydomain.com/forms.php?id=1
button2 : http://www.mydomain.com/forms.php?id=2
button3 : http://www.mydomain.com/forms.php?id=3
each link goes to different form.
i can use GET to fetch the id but how the form.php will look like?
can i use if loop or switch case
please help

Re: handling forms in the same page

Posted: Wed Mar 04, 2009 4:46 pm
by Reviresco

Code: Select all

 
<?php
if ($_GET['id'] == 1) {
?>
Form number one here
<?php
}
else if ($_GET['id'] == 2) {
?>
Form number two here
<?php
}
else if ($_GET['id'] == 3) {
?>
Form number three here
<?php
}
?>
 

Re: handling forms in the same page

Posted: Wed Mar 04, 2009 4:49 pm
by ofir0803
Thank's :lol:

Re: handling forms in the same page

Posted: Wed Mar 04, 2009 6:19 pm
by watson516
It might be easier to use a switch statement.