php - Populate table data from databse table on selecting a particuar item from drop down list? -
i want populate table data database table "onchange" event dropdown list. dropdown list contains data table contains 1 column value. when user selects of item drop down list columns , values should displayed belong particular value of selected item drop down list.
below code display dropdown list.
<?php include_once("session.php"); include_once("functions.php"); include_once("connection.php"); $employername=$_session["username"]; $sql = "select job_name job_info username=$employername"; $result = $conn->query($sql); ?> <div> <select name="ddljobname"> <?php while($row=$result->fetch_assoc()){ ?> <option value="<?= $row['job_name'] ?>"><?= $row['job_name'] ?> </option> <?php }?> </select> </div>
<select name="ddljobname" id="getdata"> <?php while($row=$result->fetch_assoc()){ ?> <option value="<?= $row['job_name'] ?>"><?= $row['job_name'] ?> </option> <?php }?> </select>
onchange function :
$('#getdata').change(function(){ var jobnum = $(this).val(); //call ajax });
Comments
Post a Comment