contact form

  • magdyzaki
  • Born
  • Born
  • magdyzaki
  • Posts: 4

Post 3+ Months Ago

Hello Dear,
I have one template and have a problem in contacts form
when I sent a massege from the contact form and go to the webmail I found no messge have receipt
so please help me to make contact form working
Best Regards
Magdy
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Posts: 677
  • Loc: Conroe, Texas

Post 3+ Months Ago

can you post your code?
  • magdyzaki
  • Born
  • Born
  • magdyzaki
  • Posts: 4

Post 3+ Months Ago

Hello dear,
Thank you for your help.
I attached two codes
first the html code that Within the contents of the template
second the php code but it wasn't found in the template but I downloaded it from another site
Attachments:
html.zip

(1.94 KiB) Downloaded 129 times

this is the code of the contacts.html page

Attachments:
php.zip

(1.47 KiB) Downloaded 134 times

this is the code of the contacts.php file

  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1244
  • Loc: Sydney

Post 3+ Months Ago

magdyzaki wrote:
Hello dear,
Thank you for your help.
I attached two codes
first the html code that Within the contents of the template
second the php code but it wasn't found in the template but I downloaded it from another sitehtml.zipphp.zip


So the html files are from the template but the php code to make it works is from another site?

Also why did you not just post it in the post with code tags?
  • magdyzaki
  • Born
  • Born
  • magdyzaki
  • Posts: 4

Post 3+ Months Ago

php code
---------------

Code: [ Select ]
<?php

$myemail = 'info(at)purestherbs(dot)com';//<-----Put Your email address here.
if(empty($_POST['name']) ||
  empty($_POST['email']) ||
  empty($_POST['message']))


$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];



{
    $to = $myemail;
    $subject = "$name";
    $email_body = "You have received a new message.".
    " Here are the details:\n Name: $name \n Email: $email \n Message \n $message";
    
    $headers = "From: $myemail\n";
    $headers .= "Reply-To: $email";

    mail($to,$subject,$email_body,$headers);
    //redirect to the 'thank you' page
    header('Location: contacts.html');
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3(dot)org/TR/html4/loose.dtd">
<html>
<head>
    <title>Contact form handler</title>
</head>

<body>
<!-- This page is displayed only if there is some error -->
<?php
echo nl2br($errors);
?>


</body>
</html>
  1. <?php
  2. $myemail = 'info(at)purestherbs(dot)com';//<-----Put Your email address here.
  3. if(empty($_POST['name']) ||
  4.   empty($_POST['email']) ||
  5.   empty($_POST['message']))
  6. $name = $_POST['name'];
  7. $email = $_POST['email'];
  8. $message = $_POST['message'];
  9. {
  10.     $to = $myemail;
  11.     $subject = "$name";
  12.     $email_body = "You have received a new message.".
  13.     " Here are the details:\n Name: $name \n Email: $email \n Message \n $message";
  14.     
  15.     $headers = "From: $myemail\n";
  16.     $headers .= "Reply-To: $email";
  17.     mail($to,$subject,$email_body,$headers);
  18.     //redirect to the 'thank you' page
  19.     header('Location: contacts.html');
  20. }
  21. ?>
  22. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3(dot)org/TR/html4/loose.dtd">
  23. <html>
  24. <head>
  25.     <title>Contact form handler</title>
  26. </head>
  27. <body>
  28. <!-- This page is displayed only if there is some error -->
  29. <?php
  30. echo nl2br($errors);
  31. ?>
  32. </body>
  33. </html>



html code
----------

Code: [ Select ]
<!DOCTYPE html>
<html lang="en">
<head>
     <title>Contact us</title>
     <meta charset="utf-8">
  <meta name="description" content="Your description">
  <meta name="keywords" content="Your keywords">
  <meta name="author" content="Your name">
  <link rel="stylesheet" href="css/style.css">
  <script src="js/jquery-1.7.1.min.js"></script>
  <script src="js/superfish.js"></script>
  <script src="js/jquery.easing.1.3.js"></script>
  <script src="js/tms-0.4.1.js"></script>
  <script src="js/slider.js"></script>
<!--[if lt IE 8]>
  <div style=' clear: both; text-align:center; position: relative;'>
   <a href="http://windows.microsoft(dot)com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode">
    <img src="http://storage.ie6countdown(dot)com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." />
  </a>
 </div>
<![endif]-->
<!--[if lt IE 9]>
    <script src="js/html5.js"></script>
    <link rel="stylesheet" href="css/ie.css">
<![endif]-->
</head>
<body>
<div class="main-bg">
  <!-- Header -->
  <header>
      <div class="inner">
      <h1 class="logo"><a href="home.html">AgroPlus - Agriculture company</a></h1>
      <nav>
        <ul class="sf-menu">
          <li><a href="home.html">home</a></li>
          <li><a href="products.html">products</a></li>
          <li>
              <a href="production.html">production</a>
          </li>
          <li><a href="pricing.html">pricing</a></li>
          <li class="current"><a href="contacts.html">contacts</a></li>
        </ul>
      </nav>
      <div class="clear"></div>
    </div>
  </header>
  <!-- Content -->
  <section id="content"><div class="ic">More Website Templates (at) TemplateMonster(dot)com. July 16, 2012!</div>
    <div class="container_24">
      <div class="wrapper">
          <div class="grid_24 content-bg">
            <div class="wrapper">
              <article class="grid_6 suffix_1 prefix_1 alpha">
                <h2>Contact info:</h2>
              <p class="p1">
                  <strong class="str-2">
                    AgroPlus
                </strong>
                <dl class="adress">
                    <dt>8901 Marmora Road, Glasgow, D04 89GR</dt>
                    <dd><span>Telephone:</span><b>+1 959 603 6035</b></dd>
                  <dd><span>Fax:</span><b>+1 504 889 9898</b></dd>
                  <dd><span>Email:</span><a href="#">mail(at)thomsander(dot)com</a></dd>
                </dl>
                <dl class="adress">
                    <dt>9863 Mill Road, Cambridge, MG09 99HT</dt>
                    <dd><span>Telephone:</span><b>+1 959 603 6035</b></dd>
                  <dd><span>Fax:</span><b>+1 504 889 9898</b></dd>
                  <dd><span>Email:</span><a href="#">mail(at)thomsander(dot)com</a></dd>
                </dl>
              </p>
            </article>
            <article class="grid_15 suffix_1 omega">
                <h2>Contact form:</h2>
              <form id="contact-form" method="post"action="contacts.php">
               <fieldset>
                <label for="name">
                    <span>Name:</span>
                  <input type="text" name="name">
                </label>
                <label for='email'>
                <span>Email:</span>
                 <input type="text" name="email">
                </label>
                <label for="message">
                 <span>Message:</span>    
                 <textarea name="message"></textarea>
                </label>
                <div class="btns">
                  <a class="button" onClick="document.getElementById('contact-form').reset()">Clear</a>
                  <a class="button" onClick="document.getElementById('contact-form').submit()">Send</a>
                </div>
               </fieldset>
              </form>
            </article>
          </div>
        </div>
      </div>
    </div>
  </section>
  <!-- Footer -->
  <footer>
      <div class="container_24">
        <div class="wrapper">
          <div class="grid_24 footer-bg">
                <div class="hr-border-2"></div>
          <div class="wrapper">
            <div class="grid_7 suffix_1 prefix_1 alpha">
                <div class="copyright">
                  &copy; 2012 <strong class="footer-logo">AgroPlus</strong>
                <div>Website Template by <a href="http://www.templatemonster(dot)com" target="_blank" rel="nofollow">www.templatemonster(dot)com</a></div>
              </div>
            </div>
            <div class="grid_4">
                <h5 class="heading-1">Archives:</h5>
              <ul class="footer-list">
                  <li><a href="#">October 2012</a></li>
                <li><a href="#">September 2012</a></li>
                <li><a href="#">August 2012</a></li>
                <li><a href="#">July 2012</a></li>
              </ul>
            </div>
            <div class="grid_4">
                <h5 class="heading-1">Links:</h5>
              <ul class="footer-list">
                  <li><a href="#">Documentation</a></li>
                <li><a href="#">Plugins</a></li>
                <li><a href="#">Suggest Ideas</a></li>
                <li><a href="#">Support Forum</a></li>
              </ul>
            </div>
            <div class="grid_4">
                <h5 class="heading-1">Support:</h5>
              <ul class="footer-list">
                  <li><a href="#">Special Proposition</a></li>
                <li><a href="#">Free Phone</a></li>
                <li><a href="#">Solutions</a></li>
              </ul>
            </div>
            <div class="grid_2 suffix_1 omega">
                <ul class="social-list">
                  <li><a href="#"><img src="images/social-icon-1.png" alt=""></a></li>
                <li><a href="#"><img src="images/social-icon-2.png" alt=""></a></li>
                <li><a href="#"><img src="images/social-icon-3.png" alt=""></a></li>
              </ul>
            </div>
          </div>
          </div>
        </div>
    </div>
  </footer>
</div>
</body>
</html>
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.      <title>Contact us</title>
  5.      <meta charset="utf-8">
  6.   <meta name="description" content="Your description">
  7.   <meta name="keywords" content="Your keywords">
  8.   <meta name="author" content="Your name">
  9.   <link rel="stylesheet" href="css/style.css">
  10.   <script src="js/jquery-1.7.1.min.js"></script>
  11.   <script src="js/superfish.js"></script>
  12.   <script src="js/jquery.easing.1.3.js"></script>
  13.   <script src="js/tms-0.4.1.js"></script>
  14.   <script src="js/slider.js"></script>
  15. <!--[if lt IE 8]>
  16.   <div style=' clear: both; text-align:center; position: relative;'>
  17.    <a href="http://windows.microsoft(dot)com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode">
  18.     <img src="http://storage.ie6countdown(dot)com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." />
  19.   </a>
  20.  </div>
  21. <![endif]-->
  22. <!--[if lt IE 9]>
  23.     <script src="js/html5.js"></script>
  24.     <link rel="stylesheet" href="css/ie.css">
  25. <![endif]-->
  26. </head>
  27. <body>
  28. <div class="main-bg">
  29.   <!-- Header -->
  30.   <header>
  31.       <div class="inner">
  32.       <h1 class="logo"><a href="home.html">AgroPlus - Agriculture company</a></h1>
  33.       <nav>
  34.         <ul class="sf-menu">
  35.           <li><a href="home.html">home</a></li>
  36.           <li><a href="products.html">products</a></li>
  37.           <li>
  38.               <a href="production.html">production</a>
  39.           </li>
  40.           <li><a href="pricing.html">pricing</a></li>
  41.           <li class="current"><a href="contacts.html">contacts</a></li>
  42.         </ul>
  43.       </nav>
  44.       <div class="clear"></div>
  45.     </div>
  46.   </header>
  47.   <!-- Content -->
  48.   <section id="content"><div class="ic">More Website Templates (at) TemplateMonster(dot)com. July 16, 2012!</div>
  49.     <div class="container_24">
  50.       <div class="wrapper">
  51.           <div class="grid_24 content-bg">
  52.             <div class="wrapper">
  53.               <article class="grid_6 suffix_1 prefix_1 alpha">
  54.                 <h2>Contact info:</h2>
  55.               <p class="p1">
  56.                   <strong class="str-2">
  57.                     AgroPlus
  58.                 </strong>
  59.                 <dl class="adress">
  60.                     <dt>8901 Marmora Road, Glasgow, D04 89GR</dt>
  61.                     <dd><span>Telephone:</span><b>+1 959 603 6035</b></dd>
  62.                   <dd><span>Fax:</span><b>+1 504 889 9898</b></dd>
  63.                   <dd><span>Email:</span><a href="#">mail(at)thomsander(dot)com</a></dd>
  64.                 </dl>
  65.                 <dl class="adress">
  66.                     <dt>9863 Mill Road, Cambridge, MG09 99HT</dt>
  67.                     <dd><span>Telephone:</span><b>+1 959 603 6035</b></dd>
  68.                   <dd><span>Fax:</span><b>+1 504 889 9898</b></dd>
  69.                   <dd><span>Email:</span><a href="#">mail(at)thomsander(dot)com</a></dd>
  70.                 </dl>
  71.               </p>
  72.             </article>
  73.             <article class="grid_15 suffix_1 omega">
  74.                 <h2>Contact form:</h2>
  75.               <form id="contact-form" method="post"action="contacts.php">
  76.                <fieldset>
  77.                 <label for="name">
  78.                     <span>Name:</span>
  79.                   <input type="text" name="name">
  80.                 </label>
  81.                 <label for='email'>
  82.                 <span>Email:</span>
  83.                  <input type="text" name="email">
  84.                 </label>
  85.                 <label for="message">
  86.                  <span>Message:</span>    
  87.                  <textarea name="message"></textarea>
  88.                 </label>
  89.                 <div class="btns">
  90.                   <a class="button" onClick="document.getElementById('contact-form').reset()">Clear</a>
  91.                   <a class="button" onClick="document.getElementById('contact-form').submit()">Send</a>
  92.                 </div>
  93.                </fieldset>
  94.               </form>
  95.             </article>
  96.           </div>
  97.         </div>
  98.       </div>
  99.     </div>
  100.   </section>
  101.   <!-- Footer -->
  102.   <footer>
  103.       <div class="container_24">
  104.         <div class="wrapper">
  105.           <div class="grid_24 footer-bg">
  106.                 <div class="hr-border-2"></div>
  107.           <div class="wrapper">
  108.             <div class="grid_7 suffix_1 prefix_1 alpha">
  109.                 <div class="copyright">
  110.                   &copy; 2012 <strong class="footer-logo">AgroPlus</strong>
  111.                 <div>Website Template by <a href="http://www.templatemonster(dot)com" target="_blank" rel="nofollow">www.templatemonster(dot)com</a></div>
  112.               </div>
  113.             </div>
  114.             <div class="grid_4">
  115.                 <h5 class="heading-1">Archives:</h5>
  116.               <ul class="footer-list">
  117.                   <li><a href="#">October 2012</a></li>
  118.                 <li><a href="#">September 2012</a></li>
  119.                 <li><a href="#">August 2012</a></li>
  120.                 <li><a href="#">July 2012</a></li>
  121.               </ul>
  122.             </div>
  123.             <div class="grid_4">
  124.                 <h5 class="heading-1">Links:</h5>
  125.               <ul class="footer-list">
  126.                   <li><a href="#">Documentation</a></li>
  127.                 <li><a href="#">Plugins</a></li>
  128.                 <li><a href="#">Suggest Ideas</a></li>
  129.                 <li><a href="#">Support Forum</a></li>
  130.               </ul>
  131.             </div>
  132.             <div class="grid_4">
  133.                 <h5 class="heading-1">Support:</h5>
  134.               <ul class="footer-list">
  135.                   <li><a href="#">Special Proposition</a></li>
  136.                 <li><a href="#">Free Phone</a></li>
  137.                 <li><a href="#">Solutions</a></li>
  138.               </ul>
  139.             </div>
  140.             <div class="grid_2 suffix_1 omega">
  141.                 <ul class="social-list">
  142.                   <li><a href="#"><img src="images/social-icon-1.png" alt=""></a></li>
  143.                 <li><a href="#"><img src="images/social-icon-2.png" alt=""></a></li>
  144.                 <li><a href="#"><img src="images/social-icon-3.png" alt=""></a></li>
  145.               </ul>
  146.             </div>
  147.           </div>
  148.           </div>
  149.         </div>
  150.     </div>
  151.   </footer>
  152. </div>
  153. </body>
  154. </html>
  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 477

Post 3+ Months Ago

To me it looks like the PHP has errors

PHP Code: [ Select ]
<?php
 
$myemail = 'info(at)purestherbs(dot)com';//<-----Put Your email address here.
 
if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message'])) {
 
    // Handle POST Errors Here
 
} else {
 
    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];
 
    $to = $myemail;
    $subject = "$name";
    $email_body = "You have received a new message.".
    " Here are the details:\n Name: $name \n Email: $email \n Message \n $message";
   
    $headers = "From: $myemail\n";
    $headers .= "Reply-To: $email";
    mail($to,$subject,$email_body,$headers);
    //redirect to the 'thank you' page
    header('Location: contacts.html');
}
?>
 
  1. <?php
  2.  
  3. $myemail = 'info(at)purestherbs(dot)com';//<-----Put Your email address here.
  4.  
  5. if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message'])) {
  6.  
  7.     // Handle POST Errors Here
  8.  
  9. } else {
  10.  
  11.     $name = $_POST['name'];
  12.     $email = $_POST['email'];
  13.     $message = $_POST['message'];
  14.  
  15.     $to = $myemail;
  16.     $subject = "$name";
  17.     $email_body = "You have received a new message.".
  18.     " Here are the details:\n Name: $name \n Email: $email \n Message \n $message";
  19.    
  20.     $headers = "From: $myemail\n";
  21.     $headers .= "Reply-To: $email";
  22.     mail($to,$subject,$email_body,$headers);
  23.     //redirect to the 'thank you' page
  24.     header('Location: contacts.html');
  25. }
  26. ?>
  27.  

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 93 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.