php Email Script

          
<?php
            //if "email" variable is filled out, send email
              if (isset($_REQUEST['email']))  {
             
              //Email information
              $mailHeaders = "From: " . $_POST["name"] . "<". $_POST["email"] .">\r\n";
              $admin_email = "example@gmail.com";
              $email = $_REQUEST['email'];
              $subject = $_REQUEST['subject'];
              $comment = $_REQUEST['comment'];
             
              //send email
              mail($admin_email, "$subject", $comment, $mailHeaders);
             
              //Email response
              echo "<p style=\"font-size: 30px;paddin-top:30px;\">Thank you for contacting us!</p></br>";
              echo "<p style=\"font-size: 25px; \">We will get back to you soon!!</p>";

              }
             
              //if "email" variable is not filled out, display the form
              else  {
            ?>

              <form method="post" onsubmit="document.location.href='#contact'">
              <input class="input-text" type="text" name="name" value="Your Name *" onFocus="if(this.value==this.defaultValue)this.value='';" onBlur="if(this.value=='')this.value=this.defaultValue;">
            <input class="input-text" type="email" name="email" value="Your E-mail *" onFocus="if(this.value==this.defaultValue)this.value='';" onBlur="if(this.value=='')this.value=this.defaultValue;">
            <input name="subject" type="hidden" value="Inquiry"/>
            <textarea class="input-text text-area" name="comment" cols="0" rows="0" onFocus="if(this.value==this.defaultValue)this.value='';" onBlur="if(this.value=='')this.value=this.defaultValue;">Your Message *</textarea>
            <input class="input-btn" type="submit" value="send message">
             
             
              </form>
             
            <?php
              }
            ?>

Comments

Popular posts from this blog

Script For Login, Logout and View Using PHP, MySQL and Bootstrap

Hyperledger Development with in 10 days — Day 6

Insert CheckBox and Radio button Data in MySQL Database Using PHP