Remembering Form Checkbox State With Initial Default Value

Aiislynn

New Member
I've got a form with a checkbox. When a user first visits the page, I want the checkbox to be 'checked'. However, if they uncheck the box and then submit the page, I want it to remain unchecked (and to remain checked if they submit the page with it checked).To determine when it has been checked and the form submitted, I'm currently doing:\[code\]<input type='checkbox' class='seeAll' name='seeAll' value='http://stackoverflow.com/questions/14511062/true' <?php if ($_POST['seeAll'] == 'true') echo checked; ?>>\[/code\]This works great for leaving the box checked when needed, however, how would I go about ensuring it stays unchecked if they submit it that way, while also being checked if they revisit the page (such as by re-entering the URL)?Thanks!
 
Back
Top