2014-05-09 40 views
0

我對我的每一個網站的網頁的格式如下:麻煩我的網站形式

<section class="footer-one"> 
<form action="sendmail.php" method="post" onsubmit="return validateForm()"> 
<div> 
<div class="row half"> 

<div class="6u"> 
<input type="text" class="text" name="name" id="contact_phone" placeholder="מספר טלפון" onfocus="if (this.value == '        טלפון נייד') this.value = '';" onchange=" telephoneCheck1()"/> 
</div> 
<div class="6u"> 
<input type="text" class="text" name="name" id="contact_name" onfocus="if (this.value == '        שם מלא') this.value = '';" onchange="nameCheck1" name="contact_name" placeholder="שם מלא" /> 
</div> 
</div> 
<div class="row half"> 
<div class="12u"> 
<textarea name="message" id="comments" placeholder=" תוכן ההודעה"></textarea> 
</div> 
</div> 
<div class="row"> 
<div class="12u"> 
<ul class="actions"> 
    <li><input type="submit" class="button button-style1" value="שלח" /></li> 
    <li><input type="reset" class="button button-style2" value="אפס" /></li> 
</ul> 
</div> 
</div> 
</div> 
</form> 
</section> 

它連接到下面的PHP:

<?php 
header ('Location: http://www.intrahouse.co.il '); 
if(isset($_POST['email'])) { 

    $email_to = "[email protected]"; 
    $email_subject = "פנייה מהאתר"; 

    $first_name = $_POST['contact_name']; 
    $telephone = $_POST['contact_phone']; 
    $comments = $_POST['comments']; 

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

    $email_message = "Form details below.\n\n"; 
    $email_message .= "First Name: ".clean_string($first_name)."\n"; 
    $email_message .= "Telephone: ".clean_string($telephone)."\n"; 
    $email_message .= "Comments: ".clean_string($comments)."\n"; 


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

也有垃圾郵件檢查一個jQuery :

var name_success = false; 
var phone_success = false; 

function validateForm() 
{ 
if (name_success == true && phone_success == true) 
{ 
alert("הפנייה נשלח בהצלח"); 
return true; 
} 
if (name_success == false) 
{ 
alert("שגיאה, ציין שם ושם משפחה תקין"); 
return false; 
} 
if (phone_success == false) 
{ 
alert("שגיאה, מספר הפלאפון שציינת אינו תקין"); 
return false; 
} 
} 

function nameCheck1(){ 
var reg=/\w{3,50}/; 
var fname = document.getElementById("first_name").value; 

if(reg.test(fname)){ 
     name_success = true; 
} 
else{ 
    alert("שגיאה, ציין שם ושם משפחה תקין"); 
    name_success = false; 
} 
} 


function telephoneCheck1(){ 
var telephone = document.getElementById("telephone").value; 
var phone = telephone.replace(/\s|-/g,''); 
var reg=/^\d+$/; 
if(reg.test(phone)){ 
    phone_success = true; 
} 
else{ 
    alert("שגיאה, מספר הפלאפון שציינת אינו תקין"); 
    phone_success = false; 
} 
} 

我失去了一些東西,因爲它不會給我任何電子郵件...形式不工作:\ 謝謝

+3

爲什麼你壓制錯誤信息然後尋求幫助? – Carsten

+1

從@郵件中刪除'@' – j08691

回答

1

您沒有name="email"的元素。因此,isset($_POST['email'])根本不可能是真實的,因此不會發送電子郵件。

要麼添加您正在尋找的name,要麼尋找name確實存在。

此外,你有兩個name="name"元素(雖然第二個擁有第二name屬性...考慮修改!)

0

你的問題是在這裏: 「的onfocus =」

<input type="text" 
class="text" 
name="name" 
id="contact_phone" 
placeholder=" מספר 

טלפון如果 (THIS.VALUE == ' טלפוןנייד') THIS.VALUE = ''; 「電平變化 =」 telephoneCheck1()「/> this.value ='';「 平變化= 「nameCheck1」 名稱= 「CONTACT_NAME」 佔位符= 「שםמלא 」/>

它更改爲:

<input type="text" class="text". name="contact_phone" 
id="contact_phone" 
placeholder=" מספר 

טלפון「 聚焦狀態=」 如果 (THIS.VALUE ==' טלפוןנייד「) THIS.VALUE = ''; 「電平變化 =」 telephoneCheck1()「/>

0

你的腳本也將你重定向到索引頁面,並嘗試暗示niet th dark apostol的建議。刪除script.php頭文件的第一行,或者把它放到某個地方。

+0

「尼采黑暗使者」?這對我來說是新的! –

+0

呵呵對不起,:) – danielvast