Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create combobox in php mysql?
    primarykey
    data
    text
    <p>I have a dropdown select that shows mysql records. What I want is to create another dropdown select to have a combobox.</p> <p>bid.php</p> <pre><code>&lt;script type="text/javascript" src="javascript/jquery.js"&gt;&lt;/script&gt; &lt;script&gt; function showUser(str) { var $txtHint = $('#txtHint'); if (str == "") { $txtHint.html(''); return; } $txtHint.load('bid_list.php?q=' + str) } &lt;/script&gt; &lt;/head&gt; &lt;body onload=showUser(str="ALL")&gt; &lt;div id="main" style="width:1150px;margin:0 auto;padding:10px;"&gt; &lt;div id="title" style="width:1150px;margin:0 auto;text-align:center;font-size:30px;color:gray;text-shadow:2px 2px #000;font-family:Verdana, Tahoma, sans-serif;"&gt;&lt;h3&gt;BIDDING LIST&lt;/h3&gt;&lt;/div&gt; &lt;div id="container" style="width:1100px;"&gt; &lt;?php $mysqli = new mysqli("localhost", "root", "", "app"); $result = $mysqli-&gt;query("SELECT bid FROM procurement WHERE bid LIKE '13-___' OR bid LIKE '1_-___' OR bid LIKE '2_-___' GROUP BY bid ORDER BY bid"); $option = ''; while($row = $result-&gt;fetch_assoc()) { $option .= '&lt;option value = "'.$row['bid'].'"&gt;'.$row['bid'].'&lt;/option&gt;'; } ?&gt; &lt;div style="text-align:center;"&gt; &lt;select name="users" onchange="showUser(this.value)" style="overflow:scroll;width:100px;"&gt; &lt;option value="ALL" selected='ALL'&gt;ALL&lt;/option&gt; &lt;?php echo $option; ?&gt; &lt;/select&gt; &lt;/div&gt; &lt;br&gt; &lt;div id="txtHint"&gt;&lt;/div&gt; </code></pre> <p>bid_list.php</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;link rel="stylesheet" href="css/style.css" type="text/css" id="" media="print, projection, screen" /&gt; &lt;script type="text/javascript" src="javascript/jquery.tablesorter.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function() { $("table").tablesorter({debug: true}); }); &lt;/script&gt; &lt;script type="text/javascript"&gt; $(function(){ var tfrow = document.getElementById('tfhover').rows.length; var tbRow=[]; for (var i=1;i&lt;tfrow;i++) { tbRow[i]=document.getElementById('tfhover').rows[i]; tbRow[i].onmouseover = function(){ this.style.backgroundColor = '#f3f8aa'; }; tbRow[i].onmouseout = function() { this.style.backgroundColor = '#ffffff'; }; } }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;?php $mysqli = new mysqli("localhost", "root", "", "app"); $q = $_GET["q"]; $where = ''; if ( $q != 'ALL' ) { $where = " WHERE bid='$q' "; } $result1 = $mysqli-&gt;query(" SELECT bid, item_name, item_description, unit, unit_cost, quantity, supplier, po_number, po_date, counter, SUM(unit_cost*quantity) AS total_amount FROM procurement $where GROUP BY counter ORDER BY bid "); echo'&lt;table id="tfhover" cellspacing="0" class="tablesorter" style="text-transform:uppercase;"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th title="Item Name"&gt;Item Name&lt;/th&gt; &lt;th title="Item Description"&gt;Description&lt;/th&gt; &lt;th title="Example : Pc, Pcs, Box and Etc."&gt;Unit&lt;/th&gt; &lt;th title="Item Price"&gt;Unit Cost&lt;/th&gt; &lt;th title="Total Item Quantity"&gt;QTY&lt;/th&gt; &lt;th title="Total Price"&gt;Total Amount&lt;/th&gt; &lt;th title="Name of Supplier"&gt;Supplier&lt;/th&gt; &lt;th title="Purchase Order #"&gt;PO #&lt;/th&gt; &lt;th title="Purchase Order Date"&gt;PO Date&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt;'; echo'&lt;tbody&gt;'; while($row = $result1-&gt;fetch_assoc()){ if($row['bid'] != '') { echo'&lt;tr&gt; &lt;td&gt;'.$row['item_name'].'&lt;/td&gt; &lt;td&gt;'.$row['item_description'].'&lt;/td&gt; &lt;td&gt;'.$row['unit'].'&lt;/td&gt; &lt;td&gt;'.number_format($row['unit_cost'], 2, '.', ',').'&lt;/td&gt; &lt;td&gt;'.$row['quantity'].'&lt;/td&gt; &lt;td&gt;'.number_format($row['total_amount'], 2, '.', ',').'&lt;/td&gt; &lt;td&gt;'.$row['supplier'].'&lt;/td&gt; &lt;td&gt;'.$row['po_number'].'&lt;/td&gt; &lt;td&gt;'.$row['po_date'].'&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;'; } } echo "&lt;/table&gt;"; if (!$mysqli) { die('Connect Error: ' . mysqli_connect_error()); } mysqli_close($mysqli); ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>What I want to do if the dropdown value is equal to 13-001 the second dropdown shows all po_number, if i choose in 2nd dropdown all the records of po_number like 12-12-CO 397 shows in table. How to do that?</p>
    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