[snip]
I want to set up a mailing list on a site, and I want a very simple
register/deregister facility. So a text field for the email address,
then
an [add] button and a [remove] button.
Now, what I really want is for both [add] and [remove] to be 'submit'
type
HTML buttons for the same form, but at the destination script I don't
know
how to tell which button was pressed, and I've a feeling I should only
have one submit button.
I can do what I want JavaScript, but can I do it just with PHP?
Any clues, or am I not being clear?
[/snip]
Use this in your form ...
<input type="submit" value="Add" action="add">
<input type="submit" value="Delete" action="remove">
in your forms processing use the following
switch ($_POST['action'] {
case "add":
...do add stuff....
break;
case "remove":
...do removal....
break;
}
See http://www.php.net/switch for more info.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php