Skip to main content

PHP Mail

<?php 
   if(isset($_POST['send']))
   {
      $name     =$_POST['name'];
      $email    =$_POST['email'];
      $number   =$_POST['number'];
      $comments =$_POST['comments'];
      
      $to="test@domain.com";
               
         $subject  = "Enquiry";
         $message  = "<h3>Enquiry from example.com</h3>";
         $message .= "<h4>Name        : $name</h4>";
         $message .= "<h4>Email       : $email</h4>";
         $message .= "<h4>Contact No  : $contact</h4>";
         $message .= "<h4>Comments    : $comments</h4><br>";
        
         $header = "From:info@example.com \r\n";
         $header = "bcc:info@example.com \r\n";
         $header .= "MIME-Version: 1.0\r\n";
         $header .= "Content-type: text/html\r\n";
         
$send = mail ($to,$subject,$message,$header);
  
if($send)
{
 echo "Mail sent Successfully";
}  
      } ?>


=================================================================

<div>
<form method=POST action="#">
<h2>Contact Us</h2>
<input placeholder="Your name" name=name type="text">
<input placeholder="Your Number" name=number type=text>
<input placeholder="Your email" name=email type=email>
<input placeholder="Comments" name=comments type=text>
<input type=submit name=send >
</form>
</div>



Comments

Popular posts from this blog

Get Current Location & Address in PHP

index.php ____________________________________________________________________ <!DOCTYPE html> <head> <title>GEt Current Location</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <script type="text/javascript"> jQuery(function($){ var lat = $('#lat'); var lng = $('#lng'); $('#submit').click(function(){ jQuery.ajax({ url: 'get_address.php', type: 'post', data: 'lat=' + lat.val() + '&lng='+lng.val(), success: function(results){ $("#ack").val(results) } }); }); }); </script> <script> if(!navigator.geolocation){ alert('Your Browser does not support HTML5 Geo Location. Please Use Newer Version Browsers'); } navigator.geolocation.getCurrentPosition(success, error); function success(position){ var latit...

HTML 5 pattern validation

<!DOCTYPE html> <html> <head> <title>html5 patterns val</title> </head> <body> <form action=""> Email :   <input type="email" name="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" required> Min Char:  <input type="password" name="pw" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" title="Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters" required> Search: <input type="search" name="search" pattern="[^'\x22]+" title="Invalid input" required> Password:   <input type="password" name="pw" pattern=".{6,}" title="Six or more characters" required> Country code: <input type="text" name="country_code" pattern="[A-Za-z]{3}" title="Three let...

AJAX POST IN PHP

AJAX POST SCRIPT ________________________________________________________ index.php ________________________________________________________ <!DOCTYPE html> <html> <head> <title>AJAX POST</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script type="text/javascript">    jQuery(function($){            var text1 = $('#text_id1');            var text2 = $('#text_id2');            $('#button_submit').click(function(){                    jQuery.ajax({                        ...