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.

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'; ?> />

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.