nd4spdbh Posted March 10, 2007 Share Posted March 10, 2007 Ok i got this contact form working like i want it to but when i added a user filled in subject it refuses to show a subject in the recieved email... WHY! then i thought it had to deal with the checking feature to make sure all feilds are filled and it brings back the error that the feilds arnt all filled in, when they are. so it seems like the subject feild never gets registered. <?php /** * Change the email address to your own. * * $empty_fields_message and $thankyou_message can be changed * if you wish. */ // Change to your own email address $your_email = $_GET[mailto]; // This is what is displayed in the email subject line // Change it if you want // This is displayed if all the fields are not filled in $empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>"; // This is displayed when the email has been sent $thankyou_message = "<p>Thankyou. Your message has been sent.</p>"; // You do not need to edit below this line $name = stripslashes($_POST['txtName']); $email = stripslashes($_POST['txtEmail']); $subject = stripslashes($_POST['txtSub']); $message = stripslashes($_POST['txtMessage']); if (!isset($_POST['txtName'])) { ?> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> <p><label for="txtName">Name:</label><br /> <input type="text" title="Enter your name" name="txtName" /></p> <p><label for="txtEmail">Email:</label><br /> <input type="text" title="Enter your email address" name="txtEmail" /></p> <p><label for="txtSub">Subject:</label><br /> <input type="text" title="Enter your Subject" name="txtSub" /></p> <p><label for="txtMessage">Your message:</label><br /> <textarea title="Enter your message" name="txtMessage"></textarea></p> <p><label title="Send your message"> <input type="submit" value="Send" /></label></p> </form> <?php } elseif (empty($name) || empty($email) || empty($message) || empty($subject)) { echo $empty_fields_message; } else { // Stop the form being used from an external URL // Get the referring URL $referer = $_SERVER['HTTP_REFERER']; // Get the URL of this page $this_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"]; // If the referring URL and the URL of this page don't match then // display a message and don't send the email. if ($referer != $this_url) { echo "You do not have permission to use this script from another URL."; exit; } // The URLs matched so send the email mail($your_email, $subject, $message, "From: $name <$email>"); // Display the thankyou message echo $thankyou_message; } ?> Link to comment https://forums.phpfreaks.com/topic/42078-contact-form-subject-not-showing-in-email/ Share on other sites More sharing options...
per1os Posted March 10, 2007 Share Posted March 10, 2007 Why are you using $_GET for $your_email??? Maybe this should be inplace of that code <?php if (isset($_GET['mailto'])) { $your_email = $_GET['mailto']; } ?> If the mailto is in the GET data and not the POST data... --FrosT Link to comment https://forums.phpfreaks.com/topic/42078-contact-form-subject-not-showing-in-email/#findComment-204104 Share on other sites More sharing options...
redarrow Posted March 10, 2007 Share Posted March 10, 2007 what all this about please cheers? // Stop the form being used from an external URL // Get the referring URL $referer = $_SERVER['HTTP_REFERER']; // Get the URL of this page $this_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"]; // If the referring URL and the URL of this page don't match then // display a message and don't send the email. if ($referer != $this_url) { echo "You do not have permission to use this script from another URL."; exit; } Link to comment https://forums.phpfreaks.com/topic/42078-contact-form-subject-not-showing-in-email/#findComment-204109 Share on other sites More sharing options...
nd4spdbh Posted March 10, 2007 Author Share Posted March 10, 2007 Ok im using the get command to get an email outta the URL [email protected] all that suff is so you cant link to it from another site i think i got it working but we will c Link to comment https://forums.phpfreaks.com/topic/42078-contact-form-subject-not-showing-in-email/#findComment-204124 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.