How to submit radio buttons from multiple groups?
Posted: Wed Sep 24, 2008 6:08 pm
I have been using radio buttons for customers to select amounts of my product inside of tables. I have over 10 different products/tables.
How can I use a single 'Submit' button at the bottom to collect data from all the groups? Each group has its own name. When I go to the action site (in this case just 1.php), I use just a simple:
echo $_POST['lavender'];
which has nothing. If I move the 'Submit' button inside of the table for lavender, I get the value I expect. Please help, here is my code so far.
How can I use a single 'Submit' button at the bottom to collect data from all the groups? Each group has its own name. When I go to the action site (in this case just 1.php), I use just a simple:
echo $_POST['lavender'];
which has nothing. If I move the 'Submit' button inside of the table for lavender, I get the value I expect. Please help, here is my code so far.
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ladybug Incense</title>
<style type="text/css">
<!--
.style1 {
font-size: 24px;
color: #FF00FF;
}
.style2 {font-size: 24px; color: #FF0066; }
-->
</style></head>
<body>
<h1>Types of Incense:</h1>
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FFFF00"><span class="style1">Lavender</span></td>
</tr>
<tr>
<td bgcolor="#00FFFF">Lavender incense is made from the finest lilac flowers, and has a hint of tulip.</td>
</tr>
<tr>
<td bgcolor="#00FFFF"><form id="form1" name="form1" method="post" action="">
<p>
<label>
<input type="radio" name="lavender" value="10" id="RadioGroup1_0" />
10 grams</label>
($10)<br />
<label>
<input type="radio" name="lavender" value="18" id="RadioGroup1_1" />
20 grams ($18)</label>
<br />
<label>
<input type="radio" name="lavender" value="25" id="RadioGroup1_2" />
30 grams ($25)</label>
<br />
<label>
<input type="radio" name="lavender" value="30" id="RadioGroup1_3" />
40 grams ($30)</label>
<br />
</p>
</form>
</td>
</tr>
</table>
<p> </p>
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FFFF00" class="style2">Jasmine</td>
</tr>
<tr>
<td bgcolor="#00FFFF">Jasmine incense is made from a variety of middle eastern flowers, mainly jasmine</td>
</tr>
<tr>
<td bgcolor="#00FFFF"><form id="form2" name="form2" method="post" action="">
<p>
<label>
<input type="radio" name="jasmine" value="12" id="RadioGroup2_0" />
10 grams ($12)</label>
<br />
<label>
<input type="radio" name="jasmine" value="20" id="RadioGroup2_1" />
20 grams ($20)</label>
<br />
<label>
<input type="radio" name="jasmine" value="28" id="RadioGroup2_2" />
30 grams ($28)</label>
<br />
<label>
<input type="radio" name="jasmine" value="32" id="RadioGroup2_3" />
40 grams ($32)</label>
<br />
</p>
</form>
</td>
</tr>
</table>
<form id="form3" name="form3" method="post" action="1.php">
<label>
<input type="submit" name="button" id="button" value="Submit" />
</label>
</form>
<p> </p>
</body>
</html>