Re: Distinguishing between submit buttons

lilley (lilley@afs.mcc.ac.uk)
Tue, 7 Mar 1995 12:23:38 +0500


Rupesh said

> Would someone know on how to distinguish between two submit buttons
> in the same form. In my application, one of them is for "Browse", while
> the other one is for "Submit". the CGI script has to take different
> actions for the two. Can't put browse in a separate form as both buttons
> need some common fields.

Use different name attributes for the two submit buttons:

<input type=submit name="browse" value="Browse...">
<input type=submit name="submit" value="Submit form">

You will get the name=value pair for a named submit button, so you can tell
which one was pressed.

--
Chris Lilley
+-------------------------------------------------------------------------+
| Technical Author, Manchester and North HPC Training & Education Centre  |
+-------------------------------------------------------------------------+
| Computer Graphics Unit,        |     Email: Chris.Lilley@mcc.ac.uk      |
| Manchester Computing Centre,   |     Voice: +44 61 275 6045             |
| Oxford Road,                   |       Fax: +44 61 275 6040             |
| Manchester, UK.  M13 9PL       |      X400: /I=c /S=lilley              |
|                 /O=manchester-computing-centre /PRMD=UK.AC /ADMD= /C=GB/|
|<A HREF="http://info.mcc.ac.uk/CGU/staff/lilley/lilley.html">my page</A> | 
+-------------------------------------------------------------------------+
|This is supposed to be data transfer, not artificial intelligence. M VanH|
+-------------------------------------------------------------------------+