简单的形式不再工作

时间:2014-01-15 16:11:02

标签: php post email-validation

这个简单的POST表单已停止运行。此表单使用jqueryfunctions.js和附加的PHP代码。这个表格一直工作到一个月前 - 代码中没有任何变化。使用此表单时它不发送,它只返回错误“不发送”消息。

PHP版本是5.2.9。非常感谢任何帮助 - 我在我的智慧结束!

PHP代码:

<?php
if(!$_POST) exit;

$values2 = array ('email2','prodLink','prodTitle2','offer');
$required2 = array('email2','prodLink','prodTitle2','offer');

$your_email2 = "sales@jimlaabsmusic.com";
$email_subject2 = "JLM.com Make An Offer";
$email_content2 = "Best Price:\n";
$email2 = $_POST['email2'];


foreach($values2 as $value2){
  if(in_array($value2,$required2)){
    if( empty($_POST['email2']) ) { 
        echo '<span class="response2">Use a valid email!</span>'; 
        exit; 
    }
    if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email2)) {
        echo '<span class="response2">Use a valid email!</span>';
        exit;
    }
    $email_content2 .= $value2.': '.$_POST[$value2]."\n\n";

  }
}

if(mail($your_email2,$email_subject2,$email_content2,'From: '.$email2)) {
    echo '<span class="response2sent">Sent!</span>'; 
} else {
    echo 'No Send!';
}
?>

以下是表单HTML代码:

div id="bestPriceOutter">
        <a onclick="ShowHideEmail('#bestPriceBox','#tradeSave'); return false;" href="#"><img src="images/other/bestoffer.png" width="208" height="25" alt="Get the best price on this product! Please enter your email" border="0" class="jqueryHighlight" /></a>
        <div class="clear"></div>
        <div id="bestPriceBox">
            <form action="php/bestprice-email.php" method="post" id="bestPriceEmail">        
                <label for="email2">Your Email</label> <input id="email2" name="email2" class="text" size="30" /> 
                <label for="offer">Your Best Offer</label> <input id="offer" name="offer" class="text" size="30" />                
                <input id="prodLink" name="prodLink" class="text" value="" type="hidden" />
                <input id="prodTitle2" name="prodTitle2" class="text" value='{TXT_PRODTITLE}' type="hidden" />
                <input type="submit" value="Send" id="submit2" class="submit" />   
            </form>
        </div>
        </div>
        <div class="clear"></div>

0 个答案:

没有答案