This is a discussion on RE: [PHP] Two Actions in a Form? within the PHP General forums, part of the PHP Programming Forums category; [snip] have the PHP script that receives the post to distinguish between which button the user clicked. Name your submit ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
[snip]
have the PHP script that receives the post to distinguish between which button the user clicked. Name your submit button different names, then use print_r($_POST) or print_r($_GET) - depending on whether you use POST or GET, and I thinkyou'll see what you need to be checking. [/snip] Another method is to name the buttons the same, but each has a different value....(using POST as an example) <form action="process_form.php" method="POST"> <input type="submit" name="action" value"Do Action One"> <input type="submit" name="action" value"Do Action Two"> </form> Then use a switch/case statement to decide what to do.... http://us2.php.net/switch <?php switch($_POST['action']){ case "Do Action One": /* do stuff */ break; case "Do Action Two": /*do other stuff */ break; } ?> |