The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Kinda Solved] Problem updating checkbox value in sessions
Hi, I have a multi page form with MANY check boxes. I've set up the form so users can log in and out and update information using sessions. (method found here: The problem I'm running into is with the checkboxes. When the user logs back in, the form is populated from sessions and the check boxes are marked as "checked" like so

<input type="Checkbox" name="a1_strategic" value="Strategic" tabindex="1"<?php if($fields['a1_strategic'] =="Strategic"){echo " checked";} else {echo "";}?>>

The initail value is saved and displayed fine, but if the user wants to edit the form and unchecks the checkbox, it doesn't clear the old value from the database when the form is submitted. I'm not sure if it's because an unchecked checkbox has no value to over ride the old value, or if it's because "checked" is written to the checkbox tag when the form is opened and, even if the checkbox is unchecked, it retains the "checked" in the code.

- First submission, user selects checkbox and value "X" is submitted to database.
- User logs back in and unchecks the checkbox and submits the form.
- If the user logs in a third time the original value of "X" is still there and the checkbox is checked. It should be showing as unchecked and no value in the session.

This is the opening php for the form

PHP Code:
$fields ft_api_init_form_page();

if (isset(
$params = array(
"submit_button" => "save-exit",
"next_page" => "exit.php",  
"form_data" => $_POST,
"no_sessions_url" => "index.php",
"may_update_finalized_submissions" => true,
"finalize" => true
$params = array(
"submit_button" => "continue",
"next_page" => "page2.php",  
"form_data" => $_POST,
"no_sessions_url" => "index.php",
"may_update_finalized_submissions" => true


I'm on a bit of a time crunch so any suggestions would be greatly appreciated.

Well, in case anyone else runs into this problem. I did find a solution, though I expect it isn't the best one, it at least got the job done. Just before each checkbox, I added a hidden control with the same name as its corresponding checkbox and a value of " ". This at least managed to clear the old values out of the session.

I'm sure I'll be coming across this issue in future projects so I would be very interested if there is a better solution.


Forum Jump:

Users browsing this thread: 1 Guest(s)