|
-
Apr 19th, 2010, 06:14 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Error on $_POST checkbox
If I tick the checkbox everything is fine, it only errors with an unchecked checkbox on line
$merit = $_POST['merit'];
It's not recognising the 'merit' form value, sorry don't have the error message, if left unticked
-
Apr 19th, 2010, 06:58 PM
#2
Re: Error on $_POST checkbox
HTML forms don't send the values of checkbox inputs that aren't checked. Try using isset() to make sure you have data before setting it:
Code:
$merit = 0;
if(isset($_POST['merit'])){
$merit = $_POST['merit'];
}
//or...
$merit = (isset($_POST['merit'])) ? $_POST['merit'] : 0;
-
Apr 19th, 2010, 07:40 PM
#3
Thread Starter
Hyperactive Member
Re: Error on $_POST checkbox
Thanks mate, works like a brought one
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|