Re: several buttons in form - which one was clicked
| From: | James | Date: | Tue, 11 Feb 2003 09:53:15 +0000 |
| Subject: | Re: several buttons in form - which one was clicked | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135179@lists.php.net to get a copy of this message | ||
Your way does strike me as a strange way to do things: I would favour many
forms with hidden values myself to but ...
<html>
<head><title><title></head>
<body>
<form action=test2.php method=get>
Press the red submit button!<br>
<input type=submit name=red value="Go!"><P>
Press the Blue submit button!<br>
<input type=submit name=blue value="Go!"><P>
But enter your name first!<br>
<input type=text name=name><p>
</form><hr>
Your name is <?php echo($_GET["name"]); ?>!<P>
<?php
if ($_GET["red"] == "Go!") { echo("You pressed the red button!"); }
if ($_GET["blue"] == "Go!") { echo("You pressed the blue button!"); }
?>
</body></html>