Manditory check box on submit form
3 posts by 2 authors in: Forums > CMS Builder
Last Post: August 30, 2011 (RSS)
By Toledoh - August 29, 2011
Hi Guys,
I need to have a checkbox "ticked" prior to a form being submitted.
the field is "declaration", and I've set up the form as
I've also got in the error checking;
But this doesn't work... any ideas?
I need to have a checkbox "ticked" prior to a form being submitted.
the field is "declaration", and I've set up the form as
<input name="declaration" type="checkbox" value="<?php echo htmlspecialchars(@$_REQUEST['declaration']) ?>">
I've also got in the error checking;
if (!@$_REQUEST['declaration']) { $alertsAndErrors .= "You tick your declaration!<br/>\n"; }
But this doesn't work... any ideas?
Cheers,
Tim (toledoh.com.au)
Tim (toledoh.com.au)
Re: [Toledoh] Manditory check box on submit form
By Dave - August 30, 2011
Hi Tim,
It's because $_REQUEST['declaration'] doesn't have a value when you first display the form, so you're getting value="".
Try using 1 for the value like this:
<input name="declaration" type="checkbox" value="1">
Let me know if that works, or if you need the value to be something specific.
Hope that helps! :)
It's because $_REQUEST['declaration'] doesn't have a value when you first display the form, so you're getting value="".
Try using 1 for the value like this:
<input name="declaration" type="checkbox" value="1">
Let me know if that works, or if you need the value to be something specific.
Hope that helps! :)
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com
Re: [Dave] Manditory check box on submit form
By Toledoh - August 30, 2011
That certainly helps! Thanks Dave
Cheers,
Tim (toledoh.com.au)
Tim (toledoh.com.au)