Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript to php the same file
    primarykey
    data
    text
    <p>I have a problem. I need to get the value from a select tag then use it in php for my sql. Here is my code</p> <pre><code>&lt;div class="form-group"&gt; &lt;label&gt; ROOMS &lt;/label&gt; &lt;?php echo "&lt;select value= 'TRoom1' id ='TRoom1' class='form control'&gt;"; echo "&lt;option&gt;Select Room Type&lt;/option&gt;"; while ($row1 = mysql_fetch_array($result2)) { echo "&lt;option&gt;" . $row1['Room_type'] . "&lt;/option&gt;"; } echo "&lt;/select&gt;"; ?&gt; </code></pre> <p></p> <p>this is for the sql command</p> <pre><code> &lt;div class="modal-body"&gt; &lt;div class="container"&gt; &lt;?php $selectedValue = $_POST['TRoom1']; $sql = "SELECT RoomNumber FROM rooms Where Room_type = '$selectedValue' "; $result = mysql_query($sql); echo "&lt;select value= 'RoomNo' id ='RoomID' class='form-control'&gt;"; echo "&lt;option&gt;Select Room Number&lt;/option&gt;"; while ($row = mysql_fetch_array($result)) { echo "&lt;option&gt;" . $row['RoomNumber'] . "&lt;/option&gt;"; } echo "&lt;/select&gt;"; ?&gt; </code></pre> <p>TIA! :))</p> <p>THis is the code ofor room type with its corresponding room number</p> <pre><code> &lt;div class="form-group"&gt; &lt;label for="exampleInputEmail1"&gt; ROOMS &lt;/label&gt; &lt;?php echo "&lt;select value= 'TRoom1' name ='TRoom1' id ='TRoom1' class='form-control'&gt;"; echo "&lt;option&gt;Select Room Type&lt;/option&gt;"; while ($row1 = mysql_fetch_array($result2)) { echo "&lt;option&gt;" . $row1['Room_type'] . "&lt;/option&gt;"; } echo "&lt;/select&gt;"; ?&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;?php $select_value=$_POST['selectedValue']; $sql = "SELECT RoomNumber FROM rooms Where Room_type = '$select_value' "; $result = mysql_query($sql); echo "&lt;select value= 'RoomNo' id ='RoomID' class='form-control'&gt;"; echo "&lt;option&gt;Select Room Number&lt;/option&gt;"; while ($row = mysql_fetch_array($result)) { echo "&lt;option&gt;" . $row['RoomNumber'] . "&lt;/option&gt;"; } echo "&lt;/select&gt;"; ?&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload