Hello I am having an issue assigning a variable to a select box selection so that i can feed the variable back into future queries. Please see code below:
<select name="room" id="msg-room">
<?php
$query = mysql_query("SELECT * FROM rooms ORDER BY ROOM asc");
while($data = mysql_fetch_assoc($query)) {
?>
<option value="<?php echo $data["roomid"]; ?>"><?php echo $data["ROOM"]; ?></option>
<?php } ?>
</select>
The selection list loads and populates fine. I just need a way to assign $data["Room"] a variable so that I can insert it into the Heading of the page as well as back into a sql query that will return the number of users in a selected room.
<?php
$query = mysql_query('SELECT * from user where room = $data[room] and account_status=1')
or
die(mysql_error());
$num_rows = mysql_num_rows($query);
echo "$num_rows Users Online"
Please help. Thank you