Form validation before email is sent input type date etc.

4 posts by 3 authors in: Forums > CMS Builder
Last Post: October 15   (RSS)

Hi all,

I have a problem with form validation before email is sent.

https://www.4fratellicaprini.co.uk/reservations.php

some fields validate but the bottom 3 don't validate. If i get rid of the validation and submit then the input of those form files do work etc, but i want to be sure the punter fills them in. 

<input type="date" class="form-control" name="dateofbooking" id="dateofbooking" value="<?=htmlspecialchars(@$_REQUEST['dateofbooking']);?>
<input type="time" class="form-control" name="timeofbooking" id="timeofbooking" value="<?=htmlspecialchars(@$_REQUEST['timeofbooking']);?>
<input type="text" class="form-control" name="howmany" id="howmany" value="<?=htmlspecialchars(@$_REQUEST['howmany']);?>

and when the form is submitted I get the errors

'Date of Booking' is required.
'Time of Booking' is required.
'How Many' is required.

### ERROR CHECKING
list($table, $num) = [$FORM_TABLE, $FORM_RECORD_NUM]; // assign shorter convenience variables
if (@$_REQUEST['name'] == '') { $errorsAndAlerts .= "'Name' is required.<br>\n"; }
if (@$_REQUEST['phone'] == '') { $errorsAndAlerts .= "'Phone' is required.<br>\n"; }
if (@$_REQUEST['email'] == '') { $errorsAndAlerts .= "'Email' is required.<br>\n"; }
if (@$_REQUEST['date_of_booking'] == '') { $errorsAndAlerts .= "'Date of Booking' is required.<br>\n"; }
if (@$_REQUEST['time_of_booking'] == '') { $errorsAndAlerts .= "'Time of Booking' is required.<br>\n"; }
if (@$_REQUEST['how_many'] == '') { $errorsAndAlerts .= "'How Many' is required.<br>\n"; }

Am grateful for any input.

cheers

kenny

Hello Kenny,

I have addressed the issues with you via email. Just let me know if you experience any other problems.

Thanks!

Tim Hurd
Senior Web Programmer
Interactivetools.com

Hi TIm

Thank you very much for being so professional, have a lovely evening.

regards

k