Page 1 of 1

[SOLVED] Submit form

Posted: Sun Jun 13, 2004 8:13 am
by ddragas
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

Posted: Sun Jun 13, 2004 8:31 am
by tim

Code: Select all

<?php
if (isset($_POST['Submit'])) {
// do something
} elseif (isset($_POST['Submit2'])) {
// do something
} // etc
?>

Posted: Sun Jun 13, 2004 11:02 am
by feyd
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.

Posted: Sun Jun 13, 2004 11:41 am
by ddragas
Thank you both for reply

Posted: Sun Jun 13, 2004 12:04 pm
by tim
yeah feyd has an excellent point.

but the code example i provided should be what you need to complete your task effeciently.