Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // set a contact form in a page directly
- <style type="text/css">
- form p{color:red}
- </style>
- <div class="my_php_form" style="text-align:center;">
- <?php
- if(isset($_REQUEST['st_send1'])){
- $name=$_REQUEST['st_name'];
- $email=$_REQUEST['st_email'];
- $comments=$_REQUEST['st_message'];
- $to="[email protected]";
- $message="Name: $name \n\n E-mail: $email \n\n Comments: $comments ";
- if( ($name == true) && ($email == true) && ($comments == true)){
- if(mail($to,"Contact from your site",$message,"From: $email")) {
- echo "<h1>Thank you, your email has been send to"." <span style='color:red'>$to</span></h1>";
- } else {
- echo "Sorry but there is an error. Try again please.";
- }
- }
- }
- ?>
- </div>
- <span class="style1">Contact to Admin</span>
- <form action="" method="post">
- <table>
- <tr>
- <td>Name:</td>
- <td>
- <input type="text" name="st_name" /><br>
- <p>
- <?php
- if(isset($_REQUEST['st_send1'])){
- if($name == true){
- // echo 'success';
- }
- else{
- echo '<span class="span_text1">Fill In Blank</span>';
- }
- }
- ?>
- </p>
- </td>
- </tr>
- <tr>
- <td>E-Mail</td>
- <td> <input type="email" name="st_email" /><br>
- <p>
- <?php
- if(isset($_REQUEST['st_send1'])){
- if($email == true){
- // echo 'success';
- }
- else{
- echo '<span class="span_text2">Fill In Blank</span>';
- }
- }
- ?>
- </p></td>
- </tr>
- <tr>
- <td>Message</td>
- <td> <textarea type="text" name="st_message" cols="50" rows="5" id="message"></textarea><br>
- <p>
- <?php
- if(isset($_REQUEST['st_send1'])){
- if($comments == true){
- // echo 'success';
- }
- else{
- echo '<span class="span_text3">Fill In Blank</span>';
- }
- }
- ?>
- </p></td>
- </tr>
- <tr> <td></td>
- <td><input type="submit" name="st_send1" value="Send" /></td>
- </tr>
- </table>
- </form>
- <script type="text/javascript">
- jQuery(document).ready(function($){
- $('input#name').click(function(){
- $('span.span_text1').hide();
- });
- $('input#email').click(function(){
- $('span.span_text2').hide();
- });
- $('textarea#message').click(function(){
- $('span.span_text3').hide();
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement