Jump to content

PHP and checkboxes


almightyegg

Recommended Posts

I wasn't sure how to check whether checkboxes had been checked, so I did this:

$pinned = $_POST['pinned'];
$locked = $_POST['locked'];

if(!$pinned){
$pinned = No;
}elseif(!$locked){
$locked = No;
}elseif(isset($locked)){
$locked = Yes;
}elseif(isset($pinned)){
$pinned = Yes;
}

 

$locked and $pinned are checkboxes from a form on the previous page.

 

It sets to No when the boxes aren't checked but when they are checked it stays at "on" and even when I tried:

if($locked == on){ etc.. it still had no affect

 

Any help would be greatly received. :)

Link to comment
https://forums.phpfreaks.com/topic/98487-php-and-checkboxes/
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.