Hi,
I have created a page that displays a list extracted from a mysql db. In each row i have a radio button.
When I view the page i am able to select all radio buttons. I would like to be able to just select one so if i try to select multiple radio buttons i can't, just the current one i have selected.
Thanks.
radio buttons
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
http://www.lastminute.com/
On the home page there is a box titled 'Search by category'.
Notice that you cannot select more than one radio button.
How can I do this using php?
Thanks.
On the home page there is a box titled 'Search by category'.
Notice that you cannot select more than one radio button.
How can I do this using php?
Thanks.
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
This is how i have coded my list:
Code: Select all
<?php
//include "auth.inc.php";
//include "b2b_header.php";
//CONNECT TO SERVER AND DATABASE
session_start();
include "conn.inc.php";
$query = "SELECT * FROM delivery" ;
$result = mysql_query($query)
or die(mysql_error());
?>
<html>
<body>
<table width="600" border="0">
<tr bgcolor="#0099CC">
<td width="414"><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Destination</font></strong></td>
<td width="103">
<div align="center"><font color="#FFFFFF"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Duration</font></strong></font></div></td>
<td width="103">
<div align="center"><font color="#FFFFFF"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Price</font></strong></font></div></td>
<td width="83"></td>
</tr>
<?php
while ($row = mysql_fetch_array($result)) {
extract($row);
echo "<tr bgcolor=\"#CAE0EE\"><td><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">";
echo $del_destination;
echo "</font></td>";
echo "<td align=\"center\"><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">";
echo $del_duration;
echo "</td></font>";
echo "<td align=\"center\"><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">";
echo $del_price;
echo "</td>";
echo "<td align=\"center\"><br>";
?>
<form name="form1" method="post" action="">
<input type="radio" name="radiobutton" value="radiobutton">
</form>
<?php
echo "</td></tr>";
}
?>
</table>
</body>
</html>- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London