For Me  
<?php 
/***************** PHP Code **********************/ 
require_once('config/bootstrap.php'); 
if(isset($_POST) && ($_REQUEST["mode"]=='send')){
$name = strip($_POST['txtname']); 
$email = strip($_POST['txtemail']); 
$ph = strip($_POST['txtphone']);
$msg = strip($_POST['txtcomment']);
$headers =  "From: ".$email."\r\n"; 
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "\r\nX-Mailer: PHP/" . phpversion();
$subject = "contact us: nethomes.com";
$message = "Name: " . $name ."<br> Phone No: " . $ph. "<br/>Email Id:".$email . "<br/>Message Details : " . $msg  ;
$to =  "bit7bpl@gmail.com"; // "arteriors51@yahoo.com"; 
if(mail($to, $subject , $message ,$headers)){ 
redirect("projectprofile.php"," Thank you for sending your valueable feedback/ query. We will get back to you as soon as possible. ");
 }
else {
redirect("projectprofile.php"," Please Try Again  ");
 }
} 
/****************   End Mail *************/
?>
/***************** JavaScript Validation ****************************/
<script>
function formvalidation(){ 
if(document.getElementById('txtname').value==''){
alert('Please enter name');document.getElementById('txtname').focus(); return false ;  }
if(document.getElementById('txtemail').value==''){
alert('Please enter Email id');document.getElementById('txtemail').focus(); return false ;  }
if(document.getElementById('txtemail').value!=''){
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
email = document.getElementById('txtemail').value ;
if(emailPattern.test(email)==false){
alert('please Enter Valid Email Id');
document.getElementById('txtemail').focus();
return false ;
 }
    }    
if(document.getElementById('txtphone').value==''){
alert('Please enter Phone no');document.getElementById('txtphone').focus(); return false ;  }
if(document.getElementById('txtcomment').value==''){
alert('Please enter message');document.getElementById('txtcomment').focus(); return false ;  }
}    
</script>
/******************* HTML Code  **********************************/
<form  action="projectprofile.php?mode=send" method="post" enctype="multipart/form-data" name="form1" id="form1">
 <table width="364" height="237" align="left" cellpadding="0" cellspacing="2">
  
 <tr> 
  <td width="29%" align="left"><p>Name </p></td>
  <td width="3%"><p>:<span class="preeti">:</span></p></td>
  <td width="68%"><label>
  <input name="txtname" type="text" id="txtname"  />
   </label></td>
   </tr>
   <tr>
  <td align="left"><p class="white">Email ID </p></td>
   <td><p>:<span class="preeti">:</span></p></td>
   <td><label>
    <input name="txtemail" type="text" id="txtemail" />
       </label></td>
    </tr>
    <tr>
 <td align="left"><p><span class="white">Tel. No. </span></p></td>
   <td width="3%"><p>:<span class="preeti">:</span></p></td>
  <td><input name="txtphone" type="text" id="txtphone"  maxlength="12" onkeypress="isnumberkey(event);" /></td>
   </tr>
  <tr>
 <td align="left"><p><span class="white">your message
 </span></p></td>
   <td><p>:<span class="preeti">:</span></p></td>
  <td><textarea name="txtcomment" cols="28" rows="4" id="txtcomment" ></textarea></td>
  </tr>
    <tr>
  <td height="26"> </td>
    <td> </td>
 <td><input name="Send" type="submit" value="   Send    " onclick="return formvalidation();" class="butt"></td>
  </tr>
  </table>
  </form>
 
 
Comments
Post a Comment
If you Satisfied , Please Leave a comment