Jump to content

Editing a checkbox


jasonhardwick

Recommended Posts

ok i have a checkbox that has a "Private" checked value and a " " unchecked value when i pull the checkbox information back into an edit page i cannot uncheck the box and save the new value into my sql any ideas?

<input name="e_private" type="checkbox" id="e_private" value="Private"<?php if (isset($row['e_private']) && $row['e_private']=="Private"){echo  'checked="checked"' ;}else{ echo " ";} ?> />

 

Link to comment
https://forums.phpfreaks.com/topic/106090-editing-a-checkbox/
Share on other sites

sorry just wondering what the new checkbox input code would be, what would be the best way to use the "$private"?

 

           <input name="e_private" type="checkbox" id="e_private" value="Private" <?php 
				$private = isset($_POST['e_private'] ? 'Private' : '';
if (isset($row['e_private']) && $row['e_private']=="Private"){
echo  'checked="checked"';
} 
?> />

Link to comment
https://forums.phpfreaks.com/topic/106090-editing-a-checkbox/#findComment-543881
Share on other sites

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.