PeekAtU Posted November 13, 2012 Share Posted November 13, 2012 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 Link to comment https://forums.phpfreaks.com/topic/270613-how-to-assign-a-value-to-a-select-box-selection-jquerymobile/ Share on other sites More sharing options...
trq Posted November 13, 2012 Share Posted November 13, 2012 Pardon? Link to comment https://forums.phpfreaks.com/topic/270613-how-to-assign-a-value-to-a-select-box-selection-jquerymobile/#findComment-1391929 Share on other sites More sharing options...
PeekAtU Posted November 13, 2012 Author Share Posted November 13, 2012 Forgive me if unclear. How can I better clarify my objective? The select box populates fine Im just looking for a way to store the selection in a variable I can pull later. Link to comment https://forums.phpfreaks.com/topic/270613-how-to-assign-a-value-to-a-select-box-selection-jquerymobile/#findComment-1391934 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.