Form validation before email is sent input type date etc.

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

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 Kenny,

In your HTML input fields, the names are dateofbooking, timeofbooking, and howmany. However, in your error checking logic, you are referencing date_of_booking, time_of_booking, and how_many. This mismatch will cause the validation to fail because the script is looking for different names than what the form is submitting.

Here’s how you can adjust your error checking code:

// Adjust field names in your validation checks
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['dateofbooking'] == '') { $errorsAndAlerts .= "'Date of Booking' is required.<br>\n"; }
if (@$_REQUEST['timeofbooking'] == '') { $errorsAndAlerts .= "'Time of Booking' is required.<br>\n"; }
if (@$_REQUEST['howmany'] == '') { $errorsAndAlerts .= "'How Many' is required.<br>\n"; }

By making these adjustments, your form validation should start working as expected.

Cheers!
Djulia

Hi TIm

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

regards

k