|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need help with code in radiobuttons
Hello!!
I was trying to get the value of radiobutton dynamically from the database because in future we might add some more columns in that field.I wrote a code but it is not working.Can anybody pls help me. <html> <body> <?php include("Dbconn.php"); ?> <?php $sql= "select distinct books from tblbooks order by Books"; $res=mysql_query($sql); $numofrows=mysql_numrows($res); $count=0; while($count<$numofrows) { $Books=mysql_result($res,$count,"Books"); ?> <input type="radio" name="nodes" value="<? echo $Books; ?>" <input type="submit" > </body> </html> |
|
#2
|
|||
|
|||
|
A couple of points off the top of my head.
1) There's no closing brace '}' for the while loop. 2) You need to increment $count in the while loop or it'll go on forever. Hope these help, -KM- |
|
#3
|
|||
|
|||
|
Thankyou
hi!!
Thankyou so much.I made those corrections and I used 'mysql_fetch_array' instead of that count in that while loop and it worked. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > Need help with code in radiobuttons |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|