sepoto Posted May 5, 2011 Share Posted May 5, 2011 I have code that creates radio buttons in a form. Right now each radio button has a unique name. Is there not a way to make it so the radio buttons are grouped or something of that nature? <?phpmysql_connect('127.0.0.1','root','**********');@mysql_select_db('methane') or die( "Unable to select database");$query="SELECT DISTINCT import_date FROM planning ORDER BY import_date ASC";$result=mysql_query($query);$num=mysql_numrows($result);?><html><head><title>Select Data Set</title></head><body><form action="displaydata.php" method="post"><div style='border: solid 1px black;'><?php$X=0;while ($X < $num) {$importdate=mysql_result($result,$X,"import_date");echo "<input type = 'Radio' Name ='" . $X . "' Value='" . $importdate . "' >";echo $importdate . "<br>";$X++;}?><input type = 'Submit' Name = 'Go' Value = 'Get Record Set'></form></div></body></html> Link to comment Share on other sites More sharing options...
birbal Posted May 5, 2011 Share Posted May 5, 2011 I am not sure what do you mean by group? in basis of what you want to group? Link to comment Share on other sites More sharing options...
sepoto Posted May 5, 2011 Author Share Posted May 5, 2011 I am not sure what do you mean by group? in basis of what you want to group? echo "<input type = 'Radio' Name ='radio' Value='" . $importdate . "' >"; I found out that if you call all of them radio that a call to $_POST["radio"] will return the Value of the one selected which in these cases is $importdate. Link to comment Share on other sites More sharing options...
birbal Posted May 5, 2011 Share Posted May 5, 2011 thats how radio button works, you can choose one option from multiple option for particular name var Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.