Hi all,
I am retrieving checkbox value data from my database, storing the values into an array and then 'checking' the appropriate checkboxes on screen if their ID's exist within my array. (My checkboxes are dynamically displayed according to how many results i get from my query)
This is working great. When I tick/check an 'unchecked' box and click to Save, I run this code to update my database which works fine:
if (isset($_POST['appselected'])) {
$centreid = $_POST['cid'];
$valueids= $_POST['appselected'];
foreach ($valueids as $said) {
$sqlquery = "UPDATE mytable SET statusid = '4' WHERE myid= '$said' AND centreid = $centreid";
$result = mysql_query($sqlquery);
}
Now this is fine, but what I would like to do is to be able to 'uncheck' a ticked box at the same time and when I click the Save button, the page will update the statusid value within the database to be lets say '2'.
How is this achieveable? How do i detect which ones to update to statusid 4 and which ones to statusid 2 at the same time?
Thanks in advance.