Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Form name= from a submitted form

Status
Not open for further replies.

jkafer

Technical User
Feb 13, 2004
32
US
I know I've done this, but for the life of me I can't remember how to do it.

I have 3 forms that will run the same update.php script.
BUt depending on the "Name" of the form, a different ending response will be given.

How to I get ahold of the name part of the form tag?

<form name="KClose" Action="update.php">
...form fields...
</form>
 
You can't really get the name of the form, you can get the name of a submit button or oits value, so if oyu have 3 forms like so:

Code:
<form name="form1" ...>
...
<input type=submit name="action1" value="Do Action 1">
</form>

<form name="form2" ...>
...
<input type=submit name="action2" value="Do Action 2">
</form>

<form name="form3" ...>
...
<input type=submit name="action3" value="Do Action 3">
</form>

you can check for them like:

Code:
if(isset($_POST['actionX']){
...do action X...
}

Or you can name them the same and check the value:
Code:
if($_POST['actionbutton']=="action1")
{
do action 1
}

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top