Jump to content

checkboxs with php


Ninjakreborn

Recommended Posts

Is there a way to make checkboxs go back to default based on session settings.
I have a form that's in 3 parts, the first 2 part's were basic drop downs and text fields.  The last one has 2 huge sections of select boxes and 1 section of dropdowns.
I was wondering when they go to the next page, and I validate the field's, if I have them come back to correct there error's is there a way to have the one's that were chosen previously to be selected as well, or is that not possible.
Link to comment
Share on other sites

You can set-
$_SESSION['checkboxes']['0']= 1/0
$_SESSION['checkboxes']['1']= 1/0
$_SESSION['checkboxes']['2']= 1/0
etc'

So every checkbox will have it's variable, and it's value will be 1 if it was checked. When you "come back to correct their error" you can echo "checked" inside the <input> tag if it's 1, or echo nothing if it's 0 :)

Orio.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.