handling forms in the same page

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

Post Reply
ofir0803
Forum Newbie
Posts: 22
Joined: Sun Jan 18, 2009 3:03 pm

handling forms in the same page

Post 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
Reviresco
Forum Contributor
Posts: 172
Joined: Tue Feb 19, 2008 4:18 pm
Location: Milwaukee

Re: handling forms in the same page

Post 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
}
?>
 
ofir0803
Forum Newbie
Posts: 22
Joined: Sun Jan 18, 2009 3:03 pm

Re: handling forms in the same page

Post by ofir0803 »

Thank's :lol:
watson516
Forum Contributor
Posts: 198
Joined: Mon Mar 20, 2006 9:19 pm
Location: Hamilton, Ontario

Re: handling forms in the same page

Post by watson516 »

It might be easier to use a switch statement.
Post Reply