[SOLVED] Submit form

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
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

[SOLVED] Submit form

Post 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
Last edited by ddragas on Thu Feb 23, 2006 4:04 am, edited 1 time in total.
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

Code: Select all

<?php
if (isset($_POST['Submit'])) {
// do something
} elseif (isset($_POST['Submit2'])) {
// do something
} // etc
?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

Thank you both for reply
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

yeah feyd has an excellent point.

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