2014-01-20 64 views
-1

我有一個表格@:http://www.shannonmoving.com/sendquote.phpPHP從驗證碼和電子郵件驗證

既然這樣,用戶只需輸入驗證碼信息發送的形式空。 我需要它,所以名稱和電子郵件地址是必需的。

我安裝了spry驗證,但驗證碼似乎繞過了這一點。

這裏的PHP

<?php 
if (($captcha_error == "on") && !isset($email)){ 
print("<div id=\"\" style=\"border: 1px solid #FFF; background: ##59A715; padding: 10px;\">There was a captcha error. Please go back and re-enter the captcha security code text.</div>"); 
$sent = "on"; 
} else 

if (($_GET['send'] == "on")&&($captcha_error == "")) { 

$message = " 
____________________________ 

    CUSTOMER DETAILS 
____________________________ 

FULL NAME:    $_POST[fullname] 
EMAIL:     $_POST[email] 
PRIMARY PHONE:   $_POST[primaryphone] 
SECONDARY PHONE:  $_POST[secondaryphone] 
REFERRED BY:   $_POST[referredby] 
PREFERRED MOVE DATE: $_POST[preferredmovedate] 
ALTERNATE MOVE DATE: $_POST[alternatemovedate] 
MOVING OUT OF:   $_POST[movingoutof] 
MOVING INTO:   $_POST[movinginto] 
PACKING REQUIRED:  $_POST[packing] 

etc,etc 


$name = "$_POST[First] $_POST[Last]"; 
$email = "$_POST[email]"; 


mail($to, $subject, $message, "From: $name <$email> \nX-Mailer:PHP/" . phpversion()); 
mail($to2, $subject, $message, "From: $name <$email> \nX-Mailer:PHP/" . phpversion()); 
mail($to3, $subject, $message, "From: $name <$email> \nX-Mailer:PHP/" . phpversion()); 
mail($to4, $subject, $message, "From: $name <$email> \nX-Mailer:PHP/" . phpversion()); 

?> 

<div style="background: #24420F; padding: 10px; border: 1px solid #FFF;"> 
Thank you for taking the time to fill out our online form it has been <br/>Successfully Sent! 
</div> 


<?php 

$sent = "on"; 
} 


if ($sent == "") { 
?> 

回答

0

添加的姓名和電子郵件輸入元素「所要求的」屬性(假設HTML 5)

<input name="email" type="email" required/> 
+0

乾杯Jimmay,但它不是HTML5,所以它不工作。不過謝謝。 – kamull61

0

我不知道,但你可以嘗試改變第一行:

if (($captcha_error == "on") && !isset($email)){ 

通過

if (($captcha_error == "on") || !isset($email)){ 
+0

非常感謝Georgio,但這不起作用,它只是直接將它帶到錯誤頁面。我欣賞它,但。 – kamull61