Re: Basic help for radio buttons needed
| From: | Mike Eheler | Date: | Tue, 05 Mar 2002 23:55:47 +0000 |
| Subject: | Re: Basic help for radio buttons needed | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87378@lists.php.net to get a copy of this message | ||
First, change your form tag to:
<form method="post" action="admin.php">
Post's are better, and to be standard-compliant it should be defined lower-case. Then in admin.php, just to see what is being returned, do:
<pre><? print_r($_POST); ?></pre>
Replace $_POST with $HTTP_POST_VARS if you're using a version of PHP older than 4.1.0.
If still there is nothing, then change admin_do[] to simply admin_do. Radio buttons only return the value of the button that was selected, so it's not really necessary to make an array out of a radio button.
Mike
Wg4- Cook wrote:
Hi all, I am sure this is a very simple question, but after reading reams of doco I still can't find the answer. I am very new to PHP and HTML coding. I have a form (html) that uses radio buttons that goes to some PHP code - how in the PHP code can I tell which radio button was selected? My HTML code (which is inside another PHP page) is as follows <form action="admin.php" method="GET"> <input type="radio" name="admin_do[]" value="Add new user">Add new user</br> <input type="radio" name="admin_do[]" value="Change User password">Change User password</br> <input type="radio" name="admin_do[]" value="Delete user">Delete User</br> <input type="radio" name="admin_do[]" value="Add new document">Add new document</br> <br> <input type="submit" name="submit" value="Select" </form> I have tried various things in admin.php but nothing gives me which radio button was selected. TIA Janet