Jump to content

Memory form - checkbox


jaArch

Recommended Posts

If you're posting to that page, but you could use session and only have to post once at the end of the form.

 

Also, you shouldn't use short tags. value="<?php echo $_POST['pending']; ?>"

 

You're just a little off.  You gotta echo the variable, and you should use delimiter.

Link to comment
Share on other sites

delimiter being talked about is the semi-colon after your variable.  And, you are echo'ing it, but judging from your post, you are wanting to know how to remember it's checked state.

 

1. A checkbox is either on or off.

2. You shouldn't use short tags, as it is being removed, and is not very portable.

3. You need to use the POST array to set the checked value.

4. You need to know which checkbox you are inquiring about, so use indexes.

 

Example

<input name="status[1]" id="pending" value="Shouldn't be a POST variable" <?php if(isset($_POST['status'][1])) echo 'checked'; ?> />

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.