varun_146100 Posted December 16, 2008 Share Posted December 16, 2008 Hi, Am very new to PHP and am stuck up right now. I have an SQL query that returns me a result set having 2 columns (Start Date , End Date) 1=> This result set needs to be generated on the selection of an item(Id) from the options in a select box. 2=> I need this result set to be displayed in radio buttons. The user can then select one of the radio button options.He can then submit the data. I need to know how can I achieve 1 & 2. Please help me on this one.Will really appreciate that. Link to comment https://forums.phpfreaks.com/topic/137181-populating-radio-buttons-from-an-sql-query-result-set/ Share on other sites More sharing options...
Yesideez Posted December 16, 2008 Share Posted December 16, 2008 As you loop through the records returned by your query have something like this: echo '<input type="checkbox" name="dates" value="'.$row['id'].'>'.$row['startdate'].' - '.$row['enddate']; You need to give them all the same name otherwise you'll be selecting one and if selecting another the other won't de-delect. Read them with this: $chosen=$_POST['dates']; Link to comment https://forums.phpfreaks.com/topic/137181-populating-radio-buttons-from-an-sql-query-result-set/#findComment-716580 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.