I am displaying a table of data on a web page, populated by a mySQL DB. The first column is a checkbox which signifies the field Done – 0 is not done, 1 is done. I want the user to be able to toggle the checkbox without hitting a submit button, and automatically update the db. So, I believe that I need an onClick in the checkbox definition that will execute a JS script. But how then do I force a reload so I can update the DB?
<input name=”checkbox” type=”checkbox” onclick=”changeProp(‘checkbox’,”,’checked’,”,’INPUT/CHECKBOX’)” value=”checkbox” <?php if ($row_rsList[‘isDone’]) {echo “checked=”checked””;} ?> />
I tried something like this and then added window.location.reload() to the JS code, but it doesn’t work.
So what is the best way to do this seemingly simple task – click on the checkbox and immediately update the db?