I have a dropdown list contains "Processed","Unreleased","Paid", that are from the Status Column. I want to add the Scanned Copy in the option but that is from the other column Scanned copy. What will Im going to do to make it work? Here's my code.
$searchstat = (!empty($_REQUEST['optstat']) ? $_REQUEST['optstat'] : '%');
$vartxtsummryNo = (!empty($_REQUEST['txtsummryNo']) ? $_REQUEST['txtsummryNo'] : '%');
if($searchstat!="%"){
$vartxtsummryNo="%";
}
$sc=ScanCopy();
$scan_copy=array("Scanned Copy");
$astatus = array("Processed","Unreleased","Paid");
$astatus = array_merge($astatus, $scan_copy);
if ($astatus[$scan_copy]) { $sc; }
foreach ($astatus as $stat){
$optstatus .= "<option " . ($searchstat == $stat ? "selected" : "") . ">$stat</option>";
}
This is the query for fetching data when Scanned copy is selected.
function ScanCopy() {
$sql2="SELECT * FROM payment_summary_log WHERE Scanned_copy IS NOT NULL ORDER BY Date_Created";
$mesconn = dbConnect();
$messtmt1 = $mesconn->prepare($sql2);
$data = $messtmt1->fetchAll(PDO::FETCH_ASSOC);
$mesconn=null;
return $data;
}
Here's the structure of search box and the dropdownlist.
echo "<form method=get name='" . $_REQUEST['option'] . ".form' autocomplete='off'>";
echo "<input type='hidden' name='option' value='" . $_REQUEST['option'] . "'>";
echo "<table class=normal2 style='font-size:0.6em;'>";
echo "<h2 style='color:blue'>Payment Summary Tracking</h2><hr>";
echo "<tr><th>Payment Summary No. :</th><td colspan=2><input type=text name='txtsummryNo' value='".$vartxtsummryNo."'> <input type=submit name='bnt_setdate' value='Find'></td>";
echo "<tr><th>Status :</th><td colspan=2><select name=optstat onchange='document.forms[\"" .$_REQUEST['option'] . ".form\"].submit();'>$optstatus</select></td></tr>";
echo "</tr></table></form>";
echo "<h2></h2><hr>";