Re: 2 submit buttons.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/2/14 Paul Halliday <paul.halliday@xxxxxxxxx>:
> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux