NYCPHP Meetup

NYPHP.org

[nycphp-talk] Form names

jessica kelly jkelly at sussex.cc.nj.us
Tue Dec 10 16:24:27 EST 2002


If you can use Javascript try

document.forms[0]. whatever for first form on page
document.forms[1]. whatever for second form on page
etc......

Jessica


>>> jellicle at inch.com 12/10/02 3:51:20 PM >>>
On Tuesday 10 December 2002 15:05 pm, Timothy P Sailer wrote:

> That's what I'm trying to do. My question is *how* to do this in PHP.
> I'm completely stumped on this one. Mainly because this is so stupid
> that I have do this, and I'm pissed.

Look, this is straightforward.  On the receiving page, all you have is 
the form variables and the action= URL.  That's it.  If there's a 
difference between those variables, you can tell the forms apart.  If 
not, you can't.  Period, full stop.  If someone writes an (idiotic) form 
like this:

----------------------------------------

Enter employee ID to fire:

<FORM ACTION="process.cgi">
<INPUT NAME="ID" TYPE="text">
<INPUT TYPE="submit" VALUE="submit">
</FORM>

Enter employee ID to promote:

<FORM ACTION="process.cgi">
<INPUT NAME="ID" TYPE="text">
<INPUT TYPE="submit" VALUE="submit">
</FORM>

----------------------------------------

.. then you can't tell them apart, period.  Quit trying.  It's their 
fault.  The form needs to be changed.  The typical approaches are to 
modify the action= URL, or add a hidden form field.

<INPUT TYPE="hidden" NAME="formaction" VALUE="promote">

<FORM ACTION="process.cgi?formaction=promote">


-- 
Michael Sims


--- Unsubscribe at http://nyphp.org/list/ ---







More information about the talk mailing list