Bullers Posted February 27, 2009 Share Posted February 27, 2009 Hello, I have the following php script which creates a list of all the available buildings and capacities in the database. while ($row= mysql_fetch_array($result)) { $builref = $row['buildingref']; $floor = $row['roomfloor']; $room = $row['roomnum']; $capactiy = $row['capacity']; $capacityquery = "SELECT capacity FROM rooms WHERE buildingref = '$builref' && roomfloor = '$floor' && roomnumber = '$room' "; $capacityresult = mysql_query($capacityquery); echo "<tr>"; echo "<input type='hidden' name='building'><td>$builref$floor$room</td></input>" ; echo "<input type='hidden' name='builref' value='$builref'></input>"; echo "<input type='hidden' name='room' value='$room'></input>"; echo "<input type='hidden' name='floor' value='$floor'></input>"; echo "<td>"; while ($row1= mysql_fetch_array($capacityresult)) { $capacity = $row1['capacity']; echo "$capacity"; } echo "</td>"; echo "<td><INPUT TYPE='RADIO' NAME='selectradio'></td>"; echo "</tr>"; ; This would output something like: Building Capacity CC011 400 () CC101 200 () CC010 100 () Where () is a radio button. I want the form to to work so if a user selects a particular radio button it will post all the information into a new page with the values of $builref $room $floor & capacity. I dont know if this makes sense but if say building CC011 was selcted the next page would show $builref = CC $floor = 0 $room = 11 $capacity = 400 Thanks for your time Link to comment https://forums.phpfreaks.com/topic/147210-phphtml-form-mysql-populated-form-with-radio-buttons/ Share on other sites More sharing options...
rwalsh Posted March 19, 2009 Share Posted March 19, 2009 what you want to do is use the $_REQUEST command. So on $builref something like this. $builref = $_REQUEST['builref'] Its all a matter of what you called the field on you previous form. Link to comment https://forums.phpfreaks.com/topic/147210-phphtml-form-mysql-populated-form-with-radio-buttons/#findComment-788575 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.