Jump to content

Mail/Contact Form error.


flatrabbit

Recommended Posts

Hello,

 

I'm having trouble with mail/contact script from a template I purchased. Thanks for your help in advance. Cheers.

 

SP

 

The Link:

http://brand32.com/clients/erin_partridge/contact.php

 

The error:

Parse error: parse error, unexpected '!' in /home/content/b/r/a/brand32/html/clients/erin_partridge/sendmail.php on line 63

 

The code:

<?php

$error = false;

 

$the_name = $_POST['stname'];

$the_email = $_POST['stemail'];

$the_website = $_POST['stwebsite'];

$the_message = $_POST['stmessage'];

 

 

 

if(!checkmymail($the_email))

{

$error = true;

$the_emailclass = "error";

}else{

$the_emailclass = "valid";

}

 

if($the_name == "")

{

$error = true;

$the_nameclass = "error";

}else{

$the_nameclass = "valid";

}

 

if($the_message == "")

{

$error = true;

$the_messageclass = "error";

}else{

$the_messageclass = "valid";

}

 

if($error == false)

{

$to      =  $_POST['emailreciever'];

$subject = "New Message from " . $_POST['sitename'];

$header  = 'MIME-Version: 1.0' . "\r\n";

$header .= 'Content-type: text/html; charset=utf-8' . "\r\n";

$header .= 'From:'. $_POST['email']  . " \r\n";

 

$message1 = nl2br($_POST['stmessage']);

 

 

$message = "New message from  $the_name <br/>

Mail: $the_email<br />

Website: $the_website <br /><br />

Message: ” . $_POST[‘stmessage’] . “

”;

 

 

if(mail($to,$subject,$message,$header))

{

header( 'Location: contact.php?id=1' ) ;

}

 

}

 

 

 

function checkmymail($mailadresse){

$email_flag=preg_match("!^\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,4}$!",$mailadresse);

return $email_flag;

}

 

 

 

 

 

?>

Link to comment
Share on other sites

Not a big regex guy, but I've never seen one begin with an !, someone let me know if this is a valid way to designate negation.

 

$email_flag=preg_match("!^\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,4}$!",$mailadresse);

 

try

$email_flag=preg_match("/^\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,4}$/",$mailadresse);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.