Re: forms and variables?
| From: | tedd | Date: | Fri, 21 Apr 2006 13:36:15 +0000 |
| Subject: | Re: forms and variables? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-234484@lists.php.net to get a copy of this message | ||
At 3:45 PM +0300 4/21/06, William Stokes wrote:
Hello, Probably a stupid one but anyway... In PHP. Is it possible to point to a variable with the HTML form name by which it was posted from? Example: //point to the variable with something like or somenthing??? $AddNew.SomeVar <form name="AddNew" method="post" action="<? $PHP_SELF ?>"> $SomeVar = "Add"; </form> <form name="DeleteOld" method="post" action="<? $PHP_SELF ?>"> $SomeVar = "Del"; </form> Or do I just have name the variables uniquely? Thanks -Will-Will: Sure, you're almost there, just make a hidden variable $whichform and use it like so: <form name="AddNew" method="post" action="<? $PHP_SELF ?>"> <input type="hidden" name="whichform" value="add" > </form> <form name="DeleteOld" method="post" action="<? $PHP_SELF ?>"> <input type="hidden" name="whichform" value="del" > </form> HTH's tedd -- -------------------------------------------------------------------------------- http://sperling.com