PHP AND JavaScript
-
I have Simple HTML FORM with SEVERAL submit buttons (have different behavior of this form processing). How Can i handle with them ? How can i see in my PhP (CGI) script, which button was submitted ? Thanks in advance !
Hi You can Define your submit buttons as following
switch($act /* or $_REQUEST['act']*/) { case "do1": //some code to handle first action break; case "do2": //some code to handle 2nd action break; case "do3": //some code to handle 3rd action }
depend on the submit button has been clicked, the value of act will change. Iman Ghasrfakhri -
Hi You can Define your submit buttons as following
switch($act /* or $_REQUEST['act']*/) { case "do1": //some code to handle first action break; case "do2": //some code to handle 2nd action break; case "do3": //some code to handle 3rd action }
depend on the submit button has been clicked, the value of act will change. Iman Ghasrfakhriyou can do in another way too. You may have different forms for each submit button. If you have some common values for each forms then you can use javascript function for getting that value. You can pass different action case for each button.
-------------------------------------------------------------------------------------------------- Hiral Shah India If you think that my answer is good enough and can be helpful for other then don't forget to vote. :)