我對我的每一個網站的網頁的格式如下:麻煩我的網站形式
<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;
}
}
我失去了一些東西,因爲它不會給我任何電子郵件...形式不工作:\ 謝謝
爲什麼你壓制錯誤信息然後尋求幫助? – Carsten
從@郵件中刪除'@' – j08691