[nycphp-talk] Form names
Michael Sims
jellicle at inch.com
Tue Dec 10 15:50:22 EST 2002
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
More information about the talk
mailing list