בניתי את הטופס הבא ,הבעיה היא שההודעה לא נשלחת ,כאילו הטופס לא עושה את ה Process ,
אין תגובה ,העמוד מתרענן וזהו .
PHP קוד:
<?php
define("VAR_ADDRESS_FROM", "from@from.from");
define("VAR_ADDRESS_TO", "to@to.to");
function contactformProcess()
{
if(!ereg("^.+@.+\\..+$", $_POST[your_jss29s]))
{
contactformMain();
}
else
{
#/ Setting up variables
$mail_headers .= "From: ".VAR_ADDRESS_FROM."\r \n";
$mail_headers .= "Reply-To: ".VAR_ADDRESS_FROM."\r \n";
$mail_headers .= "X-Mailer: PHP/" . phpversion() . "\r \n";
$mail_headers .= "Content-type: text/html; charset='windows-1255\r\n";
#/ Building message
$message = "<html dir=\"rtl\"><font face=\"Tahoma, Verdana, Arial\" size=\"2\"><br>
<strong>שם מלא :</strong> $_POST[your_name]<br><br>
<strong>מספר טלפון :</strong> $_POST[your_phone]<br><br>
<strong>סוג הרכב :</strong> $_POST[your_type]<br><br>
<strong>שנת ייצור :</strong> $_POST[your_year]<br><br>
<strong>נפח מנוע :</strong> $_POST[your_engc]<br><br>
<strong>דגם מנוע :</strong> $_POST[your_engt]<br><br>
<strong>סוג גיר :</strong> $_POST[your_gir]<br><br>
<strong>תוכן ההודעה :</strong> ".nl2br($_POST[your_message])."</font></html>";
#/ Sending E-mail
mail(VAR_ADDRESS_TO,"הודעה חדשה מאתר אינטרנט",$message,$mail_headers);
#/ Success Message
echo 'הודעתך נשלחה בהצלחה! נחזור אליך בהקדם ,תודה .';
}
}
function contactformMain()
{
echo '<form method="post">';
#/ Name
echo '<table border="0" cellspacing="25"><tr><td>שם הפונה : <br><input name="your_name" type="text" value="'.htmlspecialchars(strip_tags($_POST[your_name])).'"><br>';
if(empty($_POST[your_name]) AND isset($_POST[Submit]))
{
echo '<font color="#FF3300">אנא מלא שם מלא</font><br>';
}
#/ Phone
echo '</td><td>מס טלפון : <br><input name="your_phone" type="text" value="'.htmlspecialchars(strip_tags($_POST[your_phone])).'"><br>';
if(empty($_POST[your_phone]) AND isset($_POST[Submit]))
{
echo '<font color="#FF3300">אנא מלא מספר טלפון</font><br>';
}
#/ Car type
echo '</td></tr><tr><td>סוג הרכב : <br><input name="your_type" type="text" value="'.htmlspecialchars(strip_tags($_POST[your_type])).'"><br>';
if(empty($_POST[your_type]) AND isset($_POST[Submit]))
{
echo '<font color="#FF3300">אנא רשום את סוג הרכב</font><br>';
}
#/ Car year
echo '</td><td>שנת ייצור : <br><input name="your_year" type="text" value="'.htmlspecialchars(strip_tags($_POST[your_year])).'"><br>';
if(empty($_POST[your_year]) AND isset($_POST[Submit]))
{
echo '<font color="#FF3300">אנא רשום את שנת הייצור</font><br>';
}
#/ Engine cap
echo '</td></tr><tr><td>נפח מנוע : <br><input name="your_engc" type="text" value="'.htmlspecialchars(strip_tags($_POST[your_engc])).'"><br>';
if(empty($_POST[your_engc]) AND isset($_POST[Submit]))
{
echo '<font color="#FF3300">אנא רשום את נפח המונע</font><br>';
}
#/ Engine type
echo '</td><td>דגם מנוע : <br><input name="your_engt" type="text" value="'.htmlspecialchars(strip_tags($_POST[your_engt])).'"><i><br>מס הדגם מופיע ברשיון הרכב שלך<br></i>';
if(empty($_POST[your_engt]) AND isset($_POST[Submit]))
{
echo '<font color="#FF3300">אנא רשום את דגם המנוע</font><br>';
}
#/ Gir
echo '</td></tr></table>סוג גיר : <input name="your_gir" type="radio" value="אוטומטי" /> אוטומטי
<input name="your_gir" type="radio" value="ידני" /> ידני<br>';
if(empty($_POST[your_gir]) AND isset($_POST[Submit]))
{
echo '<font color="#FF3300">אנא בחר את סוג הגיר</font><br>';
}
#/ Message
echo 'תוכן ההודעה :<br> <textarea name="your_message" cols="40" rows="8">'.htmlspecialchars(strip_tags($_POST[your_message])).'</textarea>';
if(empty($_POST[your_message]) AND isset($_POST[Submit]))
{
echo '<font color="#FF3300"><br>אנא הכנס תוכן להודעה שלך</font><br>';
}
#/ Submit and hidden field
echo '<br><input name="Submit" type="submit" value="שלח הודעה"><input name="filter" type="hidden" value="process">';
echo '</form>';
}
#/ Handling object
switch($_POST[filter])
{
case "process":
contactformProcess();
break;
default:
contactformMain();
break;
}
?>
אשמח לסיוע ,תודה מראש