Re: 2 submit buttons.
| From: | Dmitrii Varvashenia | Date: | Tue, 15 Feb 2011 01:25:49 +0000 |
| Subject: | Re: 2 submit buttons. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-311292@lists.php.net to get a copy of this message | ||
2011/2/14 Paul Halliday <paul.halliday@gmail.com>:
> if (isset($_POST['botton1'])) {dothing1();}
> if (isset($_POST['button2'])) {dothing2();}
Hello.
in html:
<input type="submit" value="Update" name="op">
<input type="submit" value="Checkout" name="op">
in PHP
if(isset($_POST['op'])){
switch($_POST['op']){
case 'Update':
dothing1();
break;
case 'Checkout':
dothing2();
break;
default:
dohatehackersfunction(':)');
break;
}
}
PS: Don't use multiple input type="image" buttons - all IE's don't
send value attribute in POST - use CSS
--
WBR, Dmitrii
+375 29 60-LINUX, 25-LINUX, 40-LINUX
icq: 193-74-771
www.varvashenia.ru, www.seoder.ru