Thanks for replying. My query is not getting the value once the form is submitted. Let my explain you using the code i have written :
Step 1. I have a dropdown and using jQuery I am picking up the selected item and display the selected text in the textbox.
Step 2. Once this is accomplished, sql query will run thereby display the list of records in the table just below the drop down.
Code for Step 1
<select id="ddl_pay">
<option value="-1">---- Selection ----</option>
<option value="Paid">Paid</option>
<option value="UnPaid">UnPaid</option>
</select>
<script>
$("#ddl_pay").change(function (e) {
e.preventDefault();
var a = $("#ddl_pay option:selected").text();
if (a == "---- Selection ----")
{ exit; } else {
document.getElementById("sel").value = a; }
});
</script>
Code for Step 2 [ Query to display records in the table ]
<?php
//$_POST['seltext'] = "UnPaid";
if (isset($_REQUEST['a'])) {
$val = $_REQUEST['a'];
}
if (isset($_GET['a'])) {
$val = $_GET['a'];
}
if(!empty($val)){
if ($val == 'UnPaid')
{
$getrecs = "SELECT u.t_ordid, DATE_FORMAT(u.tord_dt,'%d-%m-%Y') as label_date, c.u_name, s.stat_desc FROM utmp_orders as u join user_dtls as c on c.user_id=u.user_id join status as s on s.stat_cd=u.stat_cd WHERE u.pay_flag='N'";
$retrv = mysqli_query($connection, $getrecs);
}else if ($val == 'Paid') {
$getrecs = "SELECT u.t_ordid, DATE_FORMAT(u.tord_dt,'%d-%m-%Y') as label_date, c.u_name, s.stat_desc FROM utmp_orders as u join user_dtls as c on c.user_id=u.user_id join status as s on s.stat_cd=u.stat_cd WHERE u.pay_flag='Y'";
$retrv = mysqli_query($connection, $getrecs);
}
else{ $retrv="";}
}
?>
In the above code, you see "//$_POST['seltext'] = "UnPaid";" this line checks that once the value is pass, all records are populated in the table.
Above code is working but the value of the textbox is blank, ie using inspect element it is showing :
<input type="text" id="sel" name="seltext" value style="width:50px">