|
|
# 1 |
|
חבר חדש
|
עזרה בשליחת מייל php
אוקי אז יש לי באתר איזה קטגורית צור קשר ואני רוצה אפשרות לשליחת מייל דרך האתר בעזרת PHP
אז הטופס ב Html נראה ככה: קוד:
<form method="post" action="mail.php"> <p>Name*</p><input type="text" name="customer_name" /> <br/> <p>Email*</p><input type="text" name="email"/> <br/> <p>Telephone</p> <input type="text" name="subject" /> <br/><br/> Comment*<br/> <textarea rows="6" cols="40" type="text" name="comment"></textarea> <br/><br/> <input type=reset value="Reset"> <input type=submit value="Send"> </form> בנוסף רציתי שיהיה תנאי שחייבים להזין שם אימייל ואת ההערה.. תודה מראש |
|
|
|
# 2 |
|
Winner
|
|
|
|
|
# 3 |
|
חבר בקהילה
|
HTML
קוד:
<form method="post" name="sendm" action="mail.php"> <p>Name*</p> <input type="text" name="customer_name" /> <br/> <p>Email*</p> <input type="text" name="email"/> <br/> <p>Telephone</p> <input type="text" name="phone" /><br/> <br/> Comment*<br/> <textarea rows="6" cols="40" type="text" name="comment"></textarea> <br/> <br/> <input type="reset" value="Reset"> <input type="submit" name="sendm" value="Send"> </form> קוד:
<?php
$name = $_POST['customer_name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$comment = $_POST['comment'];
if(isset($_POST['sendm']) && $name != "" && $email != "" && $phone != "" && $comment != "") {
$mail_to = "המייל שלך כאן";
$subject = "הודעה חדשה מהאתר";
$message = "Name : $name<br />Email : $email<br />Telephone : $phone<br /><br />Comment: $comment";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=windows-1255' . "\r\n";
mail($mail_to, $subject, $message, $headers);
print '<script>alert("ההודעה נשלחה.")
location.replace("index.html")</script>';
}
else {
print '<script>alert("ישנם פרטים חסרים בטופס.")
location.replace("mail.html")</script>';
}
?>
Last edited by mrns; 02-12-10 at 14:14.. |
|
![]() |
| חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים) | |
|
|