On the markup side of things, make sure all your radio buttons have the same name. So it might look like this:
Code:
<input type="radio" name="choices" value="1" /> Run Query 1
<input type="radio" name="choices" value="2" /> Run Query 2
<input type="radio" name="choices" value="3" /> Run Query 3
Then in the script that processes the post data, one way might be to store the queries in an array and use the $_POST["choices"] variable to choose the right one:
Code:
<?
$queries[0] = "SELECT * FROM blah";
$queries[1] = "SELECT id FROM table";
$queries[2] = "SELECT something FROM blah";
$query = $queries[$_POST["choices"] - 1]; // subtract 1 since arrays start at 0
$result = mysql_query($query);
Something like that.
(Of course, especially when dealing with user data and your database, you should flesh that code out a lot more to add checks to make sure they POST data is an integer and within the range of your array and all that junk. But that sample should get you started. Let me know if you need anything cleared up!)
Bookmarks