Forum Moderators: coopster

Message Too Old, No Replies

<form name="WHATEVER" method="POST" ...>

Is "WHATEVER" sent in $_POST?

         

createErrorMsg

9:34 pm on Nov 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I need to use the name of a submitted form as a qualifier for an if..else statement (several different forms are processed by the same script). If a form is submitted with the POST method, will it contain the form name in the post array? If so, how do I access it when it isn't part of a name=value pair?

This seems like basic stuff, but I have had no success in locating an answer in the php manual.

Thanks in advance for any responses.

cEM

Slade

10:05 pm on Nov 19, 2004 (gmt 0)

10+ Year Member



I don't know if you can reach the form name explicitly or not. Try searching for "php raw form post data" and see if any of the results from that are what you're after.

A cheap alternative would be to just add a hidden variable with your if's identifier value in it.

<input type="hidden" name="whoami" value="form_one">

Birdman

11:03 pm on Nov 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The name attribute of the form does not pass to the script. You can do a print_r($_POST) to see everything that gets passed. To add to Slade's suggestion, you can also name your submit buttons accordingly because they do get sent in the POST.

Regards

createErrorMsg

11:58 pm on Nov 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Those are both great ideas, neither of which had, nor likely ever would have, occurred to me. Thanks to you both! :)

cEM