preg_match() [function.preg-match]: Compilation failed ?
Bonjour, je débute totalement en php:
Ma page me renvoit cette erreur :
Citation:
Warning: preg_match() [function.preg-match]: Compilation failed: range out of order in character class at offset 12 in /home/tc81/public_html/mktgsi/contact/index.php on line 60
false
Et voici mon code actuel :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| <?php
function is_valid_email($mail)
{
if(preg_match("/[a-zA-Z0-9_-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/", $mail) > 0)
{
return true;
}
else
{
return false;
}
}
$to = "---@---.---";
$subject = $_REQUEST['title'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$send = is_valid_email($email);
If ($send)
{echo "true";}
else
{echo "false";}
if (!$email=="")
{
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{echo "<script>alert('your mail was sent successfully')</script>";}
else
{print "We encountered an error sending your mail";}
}
?> |