Jump to content

PHP/HTML Form & MYSQL populated form with radio buttons.


Bullers

Recommended Posts

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

 

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.