Jump to content

mehdymahmood

New Members
  • Posts

    3
  • Joined

  • Last visited

mehdymahmood's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thnkx scootstah , i have created drop down and i want to filter my html table by selecting the dropdown , but when i select the drop down it create 2 html table ,, but i need one html table , thanks
  2. <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <div id="txtHint"></div> <script> function showUser(str) { // alert (str); if (str == "") { document.getElementById("txtHint").innerHTML = ""; return; } else { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("txtHint").innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET", "new.php?q=" + str, true); xmlhttp.send(); } } </script> <body> <form> <select onchange="showUser(this.value)"> <option value="1" > 1 </option> <option value="3" > 3 </option> </select> <?php $con = mysqli_connect("localhost", "root", ""); mysqli_select_db($con, "crud_tutorial"); if (isset($_REQUEST['q'])) { $q = intval($_GET['q']); //echo "$q"; $sql = "SELECT * FROM customers WHERE id = '" . $q . "'"; $result = mysqli_query($con, $sql); } else { $sql = "SELECT * FROM customers "; $result = mysqli_query($con, $sql); } echo "<table> <tr> <th>id</th> <th>name</th> </tr>"; while ($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['id'] . "</td>"; echo "<td>" . $row['name'] . "</td>"; echo "</tr>"; } echo "</table>"; mysqli_close($con); ?> </form> </body> </html>
×
×
  • 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.