我的php电子邮件脚本有问题

时间:2015-02-19 18:11:41

标签: php email

以下是我正在帮助的网页:http://www.sertomachilicookoff.com/

由于某种原因,VIP列表注册不起作用。我需要它到你输入电子邮件的地方,你点击提交,你的电子邮件地址消失了,而你的弹出代码表明你已成功输入你的电子邮件等等。

我的问题是,当您输入电子邮件并点击提交时,没有任何反应。它似乎甚至没有链接到我困惑的PHP脚本。

这是php代码:

<?php
if(isset($_POST['email'])) {

// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "info@testing.com";
$email_subject = "VIP Subscription";


function died($error) {
    // your error code can go here
    echo "There was an error with your submission";
    echo $error."<br /><br />";
    die();
}

// validation expected data exists
if(
    !isset($_POST['email'])) {
    died('There was an error with your submission');       
}

$email_from = $_POST['email']; // required


$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}

if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";

function clean_string($string) {
  $bad = array("content-type","bcc:","to:","cc:","href");
  return str_replace($bad,"",$string);
}

$email_message .= "Email: ".clean_string($email_from)."\n";


// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);  
?>

<!-- include your own success html here -->

Thanks for signup up for the Newsletter!

<?php
}
?>

这是html代码/脚本

<div class="vip-signup">
        <div class="text">
            Signup to receive updates<br />
            and offers 
        </div>
        <script language="Javascript">
function validate(){
var allok = true;
document.vip.Submit.disabled="disabled";
return true;
}
</script>
<form name="vip" method="Post" action="vip/vip.php" onSubmit="return validate();">


            <div class="form">
            <input type="edit" name="email"   value="Enter your email address">
            <button class="btn" type="submit" name="Submit"></button>
          </div>

        </form>
    </div>

0 个答案:

没有答案