How can i pass the radio button values in the url

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
flaviodizuza
Forum Newbie
Posts: 1
Joined: Sat Oct 29, 2011 4:46 am

How can i pass the radio button values in the url

Post by flaviodizuza »

Hi Friends,

My code i am given in below and i want to pass the radio button value in the href link.how can i pass the radio button value also in that href link? I will be grateful if anyone can help me in this regard.

$sql = "SELECT * FROM book";
$result = mysql_query($sql);
while(list($id, $name) = mysql_fetch_row($result)) {
echo "<tr>";
echo "<td>$name</td>";
echo "<td><input type='radio' name='$name' value='amt_1yr'/>1 Year
<input type='radio' name='$name' value='amt_2yr'/>2 Year</td>" ;

echo "<td><a href=\"cart.php?action=add&id=$id&MYRADIOVALUE=CHECKED RADIO VALUE\">Add To Cart</a></td>";
echo "</tr>"; } ?>
</table>

Thanks in advance..
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: How can i pass the radio button values in the url

Post by Celauran »

If you want to do it without a page reload, you'll need to use Javascript.
Post Reply