Probé así :(
Código PHP:
Ver original<?php
require ("ClassMathGuard.php");
if($_POST)
{
$javascript_enabled = trim($_POST['browser_check']); $department = trim($_POST['dept']); $name = trim($_POST['name']); $email = trim($_POST['email']); $phno = trim($_POST['phno']); $subject = trim($_POST['subject']); $msg = trim($_POST['msg']); $selfcopy = trim($_POST['selfcopy']);
//mail settings
$headers = "From: ".$email;
$message = "Contact name: $name\nContact Email: $email\nContact Phone: $phno\n\nMessage: $msg";
if (MathGuard :: checkResult($_POST['mathguard_answer'], $_POST['mathguard_code'])) {
if ( $department == "sales") $to = $sales_address;
elseif ( $department == "support") $to = $support_address;
elseif ( $department == "billing") $to = $billing_address;
if ( $name == "" )
{
$result = "Name field is required";
}
elseif (!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/", $email)) {
$result = "Enter a valid email address";
}
elseif(!preg_match("/^(([0-9]{2}-[0-9]{8})|([0-9]{3}-[0-9]{7}))$/", $celno)) //check for a pattern of 91-0123456789 ej: 221-4593367 {
$result = "Tipia bien el numero de celu!";
}
elseif(!preg_match("/^[0-9]{3}-[0-9]{8}$/", $celno)) //check for a pattern of 91-0123456789 ej: 221-4593367 {
$result = "Enter a valid celphone number";
}
elseif ( $subject == "" )
{
$result = "Subject is required";
}
{
$result = "Write more than 10 characters";
}
else
{
mail($to, $subject, $message, $headers); if( $selfcopy == "yes" )
mail($email, $subject, $message, $headers); $result = "Your mail has been sent succesfully!";
}
}
else $result = "Bad Answer, Please try again!";
if($javascript_enabled == "true") {
echo $result;
}
}
?>
Que hice mal?
Gracias de nuevo!