By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,300 Members | 1,867 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,300 IT Pros & Developers. It's quick & easy.

Feedback form problem

P: 64
I have a feedback form code which does email but does not display the correct content.

In place of the email address, it displays "+1"

And the body message is "1"

It works well when I test it on localhost.

As in

FROM: +1

MESSAGE:+1

What is missing in my code, some body help

My code

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require_once 'functions.php';
  3. require_once'template.php';
  4.  
  5. Head('Make an Order/enquiry');
  6. ?>
  7.  
  8. <div id="pgcontent">
  9. <h3><em>Place your Order/Enquiry</em></h3>
  10. <?php
  11.  
  12. // Change to your own email address
  13.  
  14. $your_email = "sunny@lavis-casual.com";
  15.  
  16. // This is what is displayed in the email subject line
  17.  
  18. $subject = "LAVIS-CASUAL email order/enquiry";
  19.  
  20. // This is displayed if all the fields are not filled in
  21.  
  22. $empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>";
  23.  
  24. // This is displayed when the email has been sent
  25. $thankyou_message = "<p>Thankyou. Your message has been sent. We will be contacting you shortly.</p>";
  26.  
  27. $name = "";
  28.  
  29. $email = "";
  30.  
  31. $message = "";
  32.  
  33. //Email variables
  34. $name = stripslashes(isset($_POST['txtName']));
  35.  
  36. $email = stripslashes(isset($_POST['txtEmail']));
  37.  
  38. $message = stripslashes(isset($_POST['txtMessage']));
  39.  
  40.  
  41. if (!isset($_POST['txtName'])) {
  42. ?>
  43. <form name="frmOrder" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
  44.     <p>
  45.       <label>Full Name:</label>
  46.       <br>
  47.     <input type="text" title="Enter your name" name="txtName" size="50"></p>
  48.     <p>
  49.       <label>Email address:</label>
  50.       <br>
  51.       <input name="txtEmail" type="text" title="Enter your email address" value="" size="50">
  52.     </p>
  53.     <p><label>Your message:</label><br>
  54.     <textarea name="txtMessage" cols="50" rows="5" title="Enter your message"></textarea>
  55.     </p>
  56.     <p><label title="Send your message">
  57.     <input type="submit" value="Send" onClick="return checkOrder();"></label>
  58.     <input name="Reset" type="reset" value="Clear form">
  59.     </p>
  60. </form>
  61.  
  62. <?php
  63.  
  64. }
  65.  
  66. else {
  67.  
  68.     // Stop the form being used from an external URL
  69.  
  70.     // Get the referring URL
  71.  
  72.     $referer = $_SERVER['HTTP_REFERER'];
  73.  
  74.     // Get the URL of this page
  75.  
  76.     $this_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"];
  77.  
  78.     // If the referring URL and the URL of this page don't match then
  79.  
  80.     // display a message and don't send the email.
  81.  
  82.     if ($referer != $this_url) {
  83.  
  84.         echo "You do not have permission to access this form from another URL.";
  85.  
  86.         exit;
  87.  
  88.     }
  89.  
  90.     // The URLs matched so send the email
  91.  
  92.     mail($your_email, $subject, $message, "From: $name <$email>");
  93.  
  94.     // Display the thankyou message
  95.  
  96.     echo $thankyou_message;
  97.  
  98. }
  99. ?>
  100. <script>
  101. function checkOrder()
  102. {
  103.     with (window.document.frmOrder) 
  104.     {
  105.         if (txtName.value.length < 3)
  106.             {
  107.             alert('Enter Your full name!');
  108.             txtName.focus();
  109.             return false;
  110.             } 
  111.  
  112.         else if (txtEmail.value.length < 1 || txtEmail.value.indexOf("@", 0) == -1)
  113.         {            
  114.         alert ("Please enter a valid email address!");
  115.         txtEmail.focus();
  116.         return false; 
  117.         }   
  118.  
  119.         else if (txtMessage.value == "") 
  120.         {
  121.             alert('Enter your order/enquiry details!');
  122.             txtMessage.focus();
  123.             return false;
  124.         } 
  125.  
  126.         else 
  127.         {
  128.             return true;
  129.         }
  130.     }
  131. }
  132. </script>
  133. </div>
  134.  
  135. <?php
  136. Footer();
  137. ?>
  138.  
  139.  
Aug 5 '09 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.