Post view

Simple PHP Code that allows visitors to send you an E-mail from your Site

If you like it, let me know :-)

<?php
    $email_to = "THE EMAIL YOU WANT THE MESSAGE TO BE DELIVERED TO";
    $first = $_POST["first"];
    $last = $_POST["last"];
    $email = $_POST["email"];
    $company = $_POST["company"];
    $phone = $_POST["phone"];
    $message = $_POST["message"];
    $text = "NAME: $first    $last <br>
     EMAIL: $email<br>
     COMPANY: $company<br>
     TELEPHONE NUMBER: $phone<br>    
     MESSAGE: $message";
    $headers = "MIME-Version: 1.0" . "\r\n"; 
    $headers .= "Content-type:text/html; charset=utf-8" . "\r\n"; 
    $headers .= "From: <$email>" . "\r\n";
    mail($email_to, "Message", $text, $headers);
    ?>    

<!DOCTYPE html> <html> <head> </head> <body>
<form action="mailer.php" id="contact_form" method="post"> <ul class="form"> <li class="short"> <label>First Name<span class="required"></span></label> <input type="text" name="first" id="first" value="First Name" class="requiredField" onblur="if(this.value == '') { this.value = 'First Name'; }" onfocus="if(this.value == 'First Name') { this.value = ''; }" /> </li> <li class="short"> <label>Last Name<span class="required"></span></label> <input type="text" name="last" id="last" value="Last Name" class="requiredField" onblur="if(this.value == '') { this.value = 'Last Name'; }" onfocus="if(this.value == 'Last Name') { this.value = ''; }" /> </li> <li class="long"> <label>Email Address<span class="required"></span></label> <input type="text" name="email" id="email" value="Email Address" class="requiredField email" onblur="if(this.value == '') { this.value = 'Email Address'; }" onfocus="if(this.value == 'Email Address') { this.value = ''; }" /> </li> <li class="short"> <label>Company Name</label> <input type="text" name="company" id="company" value="Company Name" class="requiredField" onblur="if(this.value == '') { this.value = 'Company Name'; }" onfocus="if(this.value == 'Company Name') { this.value = ''; }" /> </li> <li class="short"> <label>Telephone Number</label> <input type="text" name="phone" id="phone" value="Telephone Number" class="requiredField" onblur="if(this.value == '') { this.value = 'Telephone Number'; }" onfocus="if(this.value == 'Telephone Number') { this.value = ''; }" /> </li> <li class="textarea"> <label>Message<span class="required"></span></label> <textarea name="message" id="message" rows="20" cols="30"></textarea> </li> <li class="button"><input name="submitted" id="submitted" value="Submit" class="submit" type="submit" /> </li>
</body></html>
SearchSA 13.06.2018 0 109
Comments
Order by: 
Per page:
 
  • There are no comments yet
Post info
13.06.2018 (32 days ago)
Rate
2 votes
Actions
Recommend
Categories
Coding (1 posts)
Development (1 posts)