I'm having some issue with my PHP. I'm new to it, so it's all kind of confusing. But the big issue is trying to send email thru a contact form and failing miserably.
I get this error:
Parse error: syntax error, unexpected '$name' (T_VARIABLE) in C:\wamp\www\mtltechevents\contact_form.php on line 7
Line 7:
$name = $_POST['name1'];
I can't see a syntax error. When I remove the error message, it echoes back when I try to fill in the info, as well:
$name = $_POST['name1'];
$email = $_POST['email1'];
$message = $_POST['message1'];
$contact = $_POST['contact1'];
$email = filter_var($email, FILTER_SANITIZE_EMAIL); // Sanitizing E-mail.
// After sanitization Validation is performed
if (filter_var($email1, FILTER_VALIDATE_EMAIL)) {
if (!preg_match("/^\s*(?:\+?(\d{1,3}))?[-. (]*(\d{3})[-. )]*(\d{3})[-. ]* (\d{4})(?: *x(\d+))?\s*$/", $contact)) {
echo "<span>* Please Fill Valid Contact No. *</span>";
Any thoughts? I checked out some of the other issues with contact forms and none really answered what my problem was.