sevigol
دوشنبه 13 دی 1389, 12:42 عصر
با سلام وخسته نباشد
من يه وب سايت دارم كه بعضي از صفحات آن مثلا صفحه ارتباط با ما بايد اعتبار سنجي بشه كه من اين رو نوشتم اما وقتي اون رو اجرا مي كنم ودكمه ارسال رو مي زنم صفحه send.phpبه جايي اينكه اجرا بشه به صورت يه فايل دانلود شده در مياد كه گزينه هاي save/open/cancel داره
خواهش مي كنم كمك كنيد زمان زيادي واسم نمونده
كدها رو مي زارم اگه ايرادي داشته باشه ممنون ميشم راهنمايي كنيد
html:
<form name="send" method="POST" action="send.php">
<div id="divMain" dir="rtl">
<table border="0" cellpadding="0" cellspacing="2">
<tbody><tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
<span id="ctl00_cphCenter_ucContact1_lblName">نام :</span>
</td>
<td>
<input name="Name" id="ctl00_cphCenter_ucContact1_txtName" style="border: 1px solid rgb(198, 217, 255); background-color: rgb(243, 243, 243); font-family: Tahoma; font-size: 9pt; height: 18px; width: 150px;" type="text">
<span id="ctl00_cphCenter_ucContact1_rfValidatorName" style="color: Red; font-family: Tahoma; font-size: 9pt; visibility:visible;">*</span>
</td>
</tr>
<tr>
<td>
<span id="ctl00_cphCenter_ucContact1_lblEmail">ایمیل:</span>
</td>
<td>
<input name="Email" id="ctl00_cphCenter_ucContact1_txtEmail" style="border: 1px solid rgb(198, 217, 255); background-color: rgb(243, 243, 243); font-family: Tahoma; font-size: 9pt; height: 18px; width: 150px;" type="text">
<span id="ctl00_cphCenter_ucContact1_rfValidatorEmail" style="color: Red; font-family: Tahoma; font-size: 9pt; visibility:visible;">*</span>
<span id="ctl00_cphCenter_ucContact1_RegularExpressionValida tor1" style="color: Red; font-family: Tahoma; font-size: 9pt; visibility: hidden;">ایمیل نامعتبر</span>
</td>
</tr>
<tr>
<td>
<span id="ctl00_cphCenter_ucContact1_lblTel">شماره تلفن:</span>
</td>
<td>
<input name="Tel" id="ctl00_cphCenter_ucContact1_txtTel" style="border: 1px solid rgb(198, 217, 255); background-color: rgb(243, 243, 243); font-family: Tahoma; font-size: 9pt; height: 18px; width: 150px;" type="text">
</td>
</tr>
<tr>
<td>
<span id="ctl00_cphCenter_ucContact1_lblGroup">موضوع پیام:</span>
</td>
<td>
<select name="ctl00$cphCenter$ucContact1$drpGroup" id="ctl00_cphCenter_ucContact1_drpGroup" style="border-style: solid; border-width: 1px; background-color: rgb(243, 243, 243); font-family: Tahoma; font-size: 9pt; width: 150px;">
<option value="0">انتخاب کنید</option>
<option value="1">پیشنهاد</option>
<option value="2">انتقاد</option>
<option value="3">پذيرش نمايندگي</option>
<option value="4">سایر</option>
</select>
<span id="ctl00_cphCenter_ucContact1_cmpValidatorGroup" style="color: Red; visibility:visible;">*</span>
</td>
</tr>
<tr>
<td>
<span id="ctl00_cphCenter_ucContact1_lblTitle">عنوان پیام:</span>
</td>
<td>
<input name="ctl00$cphCenter$ucContact1$txtTitle" id="ctl00_cphCenter_ucContact1_txtTitle" style="border: 1px solid rgb(198, 217, 255); background-color: rgb(243, 243, 243); font-family: Tahoma; font-size: 9pt; height: 18px; width: 360px;" type="text">
</td>
</tr>
<tr>
<td>
<span id="ctl00_cphCenter_ucContact1_lblMessage">متن پیام:</span>
</td>
<td>
<textarea name="ctl00$cphCenter$ucContact1$txtMessage" rows="2" cols="20" id="ctl00_cphCenter_ucContact1_txtMessage" style="border: 1px solid rgb(198, 217, 255); background-color: rgb(243, 243, 243); font-family: Tahoma; font-size: 9pt; height: 60px; width: 360px;"></textarea>
<span id="ctl00_cphCenter_ucContact1_rfValidatorMessage" style="color: Red; font-family: Tahoma; font-size: 9pt; visibility: visible;">*</span>
</td>
</tr>
<tr>
<td>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<tbody><tr>
<td>
<input name="ctl00$cphCenter$ucContact1$btnSendMessage" value="ارسال" onclick='javascript:WebForm_DoPostBackWithOptions( new WebForm_PostBackOptions("ctl00$cphCenter$ucContact1$btnSendMessage", "", true, "SendMessage", "", false, false))' id="ctl00_cphCenter_ucContact1_btnSendMessage" style="font-family: Tahoma; font-size: 9pt; width: 100px;" type="submit">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td height="30">
</td>
<td>
<div id="divImage" style="display: none; width: 18px;">
<img alt="Processing..." src="img/spinner.gif">
</div>
</td>
</tr>
</tbody></table>
</div>
</fieldset>
</form>
-------------------------------------
php code:
<?php
if (!empty($_POST['Name'])){
$msg = "fname; $_POST[Name] ";
}else{
$fname = NULL;
echo "Please fill out your first name.";
}
if (!empty($_POST['Email'])){
$msg .= "lname: $_POST[Email] ";
}else{
$lname = NULL;
echo "Please fill out your Email.
";
}
if (!empty($_POST['Tel'])){
$msg .= "email: $_POST[Tel] ";
}else{
$email = NULL;
echo "Please leave your telephone.
";
}
if (!empty($_POST['comments'])){
$msg .= "comments: $_POST[comments] ";
}else{
$comments = NULL;
echo "You forgot to leave a comment.
";
}
$recipient = "info@ehc.co.ir";
$subject = "Form Feedback";
$mailheaders = "Reply-to: $_POST[email]";
//send the mail
mail($recipient, $subject, $msg, $mailheaders);
?>
من يه وب سايت دارم كه بعضي از صفحات آن مثلا صفحه ارتباط با ما بايد اعتبار سنجي بشه كه من اين رو نوشتم اما وقتي اون رو اجرا مي كنم ودكمه ارسال رو مي زنم صفحه send.phpبه جايي اينكه اجرا بشه به صورت يه فايل دانلود شده در مياد كه گزينه هاي save/open/cancel داره
خواهش مي كنم كمك كنيد زمان زيادي واسم نمونده
كدها رو مي زارم اگه ايرادي داشته باشه ممنون ميشم راهنمايي كنيد
html:
<form name="send" method="POST" action="send.php">
<div id="divMain" dir="rtl">
<table border="0" cellpadding="0" cellspacing="2">
<tbody><tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
<span id="ctl00_cphCenter_ucContact1_lblName">نام :</span>
</td>
<td>
<input name="Name" id="ctl00_cphCenter_ucContact1_txtName" style="border: 1px solid rgb(198, 217, 255); background-color: rgb(243, 243, 243); font-family: Tahoma; font-size: 9pt; height: 18px; width: 150px;" type="text">
<span id="ctl00_cphCenter_ucContact1_rfValidatorName" style="color: Red; font-family: Tahoma; font-size: 9pt; visibility:visible;">*</span>
</td>
</tr>
<tr>
<td>
<span id="ctl00_cphCenter_ucContact1_lblEmail">ایمیل:</span>
</td>
<td>
<input name="Email" id="ctl00_cphCenter_ucContact1_txtEmail" style="border: 1px solid rgb(198, 217, 255); background-color: rgb(243, 243, 243); font-family: Tahoma; font-size: 9pt; height: 18px; width: 150px;" type="text">
<span id="ctl00_cphCenter_ucContact1_rfValidatorEmail" style="color: Red; font-family: Tahoma; font-size: 9pt; visibility:visible;">*</span>
<span id="ctl00_cphCenter_ucContact1_RegularExpressionValida tor1" style="color: Red; font-family: Tahoma; font-size: 9pt; visibility: hidden;">ایمیل نامعتبر</span>
</td>
</tr>
<tr>
<td>
<span id="ctl00_cphCenter_ucContact1_lblTel">شماره تلفن:</span>
</td>
<td>
<input name="Tel" id="ctl00_cphCenter_ucContact1_txtTel" style="border: 1px solid rgb(198, 217, 255); background-color: rgb(243, 243, 243); font-family: Tahoma; font-size: 9pt; height: 18px; width: 150px;" type="text">
</td>
</tr>
<tr>
<td>
<span id="ctl00_cphCenter_ucContact1_lblGroup">موضوع پیام:</span>
</td>
<td>
<select name="ctl00$cphCenter$ucContact1$drpGroup" id="ctl00_cphCenter_ucContact1_drpGroup" style="border-style: solid; border-width: 1px; background-color: rgb(243, 243, 243); font-family: Tahoma; font-size: 9pt; width: 150px;">
<option value="0">انتخاب کنید</option>
<option value="1">پیشنهاد</option>
<option value="2">انتقاد</option>
<option value="3">پذيرش نمايندگي</option>
<option value="4">سایر</option>
</select>
<span id="ctl00_cphCenter_ucContact1_cmpValidatorGroup" style="color: Red; visibility:visible;">*</span>
</td>
</tr>
<tr>
<td>
<span id="ctl00_cphCenter_ucContact1_lblTitle">عنوان پیام:</span>
</td>
<td>
<input name="ctl00$cphCenter$ucContact1$txtTitle" id="ctl00_cphCenter_ucContact1_txtTitle" style="border: 1px solid rgb(198, 217, 255); background-color: rgb(243, 243, 243); font-family: Tahoma; font-size: 9pt; height: 18px; width: 360px;" type="text">
</td>
</tr>
<tr>
<td>
<span id="ctl00_cphCenter_ucContact1_lblMessage">متن پیام:</span>
</td>
<td>
<textarea name="ctl00$cphCenter$ucContact1$txtMessage" rows="2" cols="20" id="ctl00_cphCenter_ucContact1_txtMessage" style="border: 1px solid rgb(198, 217, 255); background-color: rgb(243, 243, 243); font-family: Tahoma; font-size: 9pt; height: 60px; width: 360px;"></textarea>
<span id="ctl00_cphCenter_ucContact1_rfValidatorMessage" style="color: Red; font-family: Tahoma; font-size: 9pt; visibility: visible;">*</span>
</td>
</tr>
<tr>
<td>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<tbody><tr>
<td>
<input name="ctl00$cphCenter$ucContact1$btnSendMessage" value="ارسال" onclick='javascript:WebForm_DoPostBackWithOptions( new WebForm_PostBackOptions("ctl00$cphCenter$ucContact1$btnSendMessage", "", true, "SendMessage", "", false, false))' id="ctl00_cphCenter_ucContact1_btnSendMessage" style="font-family: Tahoma; font-size: 9pt; width: 100px;" type="submit">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td height="30">
</td>
<td>
<div id="divImage" style="display: none; width: 18px;">
<img alt="Processing..." src="img/spinner.gif">
</div>
</td>
</tr>
</tbody></table>
</div>
</fieldset>
</form>
-------------------------------------
php code:
<?php
if (!empty($_POST['Name'])){
$msg = "fname; $_POST[Name] ";
}else{
$fname = NULL;
echo "Please fill out your first name.";
}
if (!empty($_POST['Email'])){
$msg .= "lname: $_POST[Email] ";
}else{
$lname = NULL;
echo "Please fill out your Email.
";
}
if (!empty($_POST['Tel'])){
$msg .= "email: $_POST[Tel] ";
}else{
$email = NULL;
echo "Please leave your telephone.
";
}
if (!empty($_POST['comments'])){
$msg .= "comments: $_POST[comments] ";
}else{
$comments = NULL;
echo "You forgot to leave a comment.
";
}
$recipient = "info@ehc.co.ir";
$subject = "Form Feedback";
$mailheaders = "Reply-to: $_POST[email]";
//send the mail
mail($recipient, $subject, $msg, $mailheaders);
?>