W3C home > Mailing lists > Public > public-html@w3.org > May 2007

Re: Several button "Submit"

From: Maurice <maurice@thymeonline.com>
Date: Wed, 02 May 2007 14:52:47 -0400
To: HTML Working Group <public-html@w3.org>
Message-ID: <C25E563F.2497%maurice@thymeonline.com>

On 5/2/07 12:57 PM, "Dmitry Turin" <html60@narod.ru> wrote:

> 
> Now <submit> has inscription, equal to sending value
> (equal to attribute "value").
> Sometimes it's necessary, that inscription and sending value will be
> different.
> 
> Let's add one more attribute "text",
> which will be displayed as inscription (if attribute is specified).
> 
> <input type=submit name=task value=copy   text=operation1>
> <input type=submit name=task value=move   text=operation2>
> <input type=submit name=task value=delete text=operation3>
> 
> Thus inscription "move" will be displayed on button,
> and "operation2" will be send to server.
>  
> 
> Dmitry Turin
> http://html6.by.ru
> http://sql4.by.ru
> http://computer2.by.ru

There are so many ways to avoid this situation on the server side that I
have to disagree.

<input type="submit" name="task" value="Move" />

<?php

 if($_POST['task'] == 'Copy'){ $task = 'operation1'; }
 if($_POST['task'] == 'Move'){ $task = 'operation2'; }
 if($_POST['task'] == 'Delete'){ $task = 'operation3'; }


 if($task == 'operation1' ) { ... Code to copy file ... }
 if($task == 'operation2' ) { ... Code to move file ... }
 if($task == 'operation3' ) { ... Code to delete file ... }

?>


Or you could have had 3 radio buttons. The user picks an operation from the
radio group then hits submit.
Or a select box with the 3 options.
Or somethinge else....

-- 
::   thyme online ltd
::   po box cb13650  nassau  the bahamas
::   website: http://www.thymeonline.com/
::   tel: 242 327-1864  fax: 242 377 1038
Received on Wednesday, 2 May 2007 18:52:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:15:58 GMT