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
ddragas
Forum Contributor
Posts: 445 Joined: Sun Apr 18, 2004 4:01 pm
Post
by ddragas » Sun Jun 13, 2004 8:13 am
Hi
One little question.
I've got 3 forms made for searching some data on one web page.
First submit button name is Submit
Second submit button name is Submit1
Third submit button name is Submit2
all three forms action is:
<form method=post action="result.php">
In page "result.php" should be results of serching.
How to determine witch Submit button has submited criteria for searching.
Each Submit button submits diferent criteria to search data
Last edited by
ddragas on Thu Feb 23, 2006 4:04 am, edited 1 time in total.
tim
DevNet Resident
Posts: 1165 Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio
Post
by tim » Sun Jun 13, 2004 8:31 am
Code: Select all
<?php
if (isset($_POST['Submit'])) {
// do something
} elseif (isset($_POST['Submit2'])) {
// do something
} // etc
?>
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Jun 13, 2004 11:02 am
I wouldn't look for the submit buttons being passed, since hitting enter to submit a form generally doesn't submit any button. Instead, look for the different criteria in the post/get data, since those are unique to each form.
ddragas
Forum Contributor
Posts: 445 Joined: Sun Apr 18, 2004 4:01 pm
Post
by ddragas » Sun Jun 13, 2004 11:41 am
Thank you both for reply
tim
DevNet Resident
Posts: 1165 Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio
Post
by tim » Sun Jun 13, 2004 12:04 pm
yeah feyd has an excellent point.
but the code example i provided should be what you need to complete your task effeciently.