I am running this SQL Query in PHP:
$stmt = $pdo_conn->prepare("SELECT * from porting order by field(status, 'Submitted', 'Rejected', 'Cancelled', 'Accepted') ");
$stmt->execute(array());
$records = $stmt->fetchAll(PDO::FETCH_ASSOC);
But i want to be able to add checkboxes to modify the query without refreshing the page
for example,
<input type="checkbox" name="status" value="Submitted" />
<input type="checkbox" name="status" value="Rejected" />
<input type="checkbox" name="status" value="Cancelled" />
<input type="checkbox" name="status" value="Accepted" />
so if the input with a value of 'Submitted' is checked the query will change to:
SELECT * from porting where status = 'Submitted'
and if both inputs with values 'Submitted' and 'Accepted' are checked, the query will be:
SELECT * from porting where status = 'Submitted' or status = 'Accepted'