vivefree Posted August 23, 2006 Share Posted August 23, 2006 I've created a simple form online which is then translated into a message stored in a php variable then sent using the mail() function.My first page has the form. The form's action is set to: vol_app.php. The php code in vol_app.php looks like as follows:<?php$cname = $_POST["name"];$caddress = $_POST["address"];$ccity = $_POST["city"];$cphone = $_POST["phone"];$cinterests = $_POST["interests"];$cmessage = $_POST["message"];$coded_name = htmlspecialchars($cname);$coded_address = htmlspecialchars($caddress);$coded_city = htmlspecialchars($ccity);$coded_phone = htmlspecialchars($cphone);$coded_interests = htmlspecialchars($cinterests);$coded_message = htmlspecialchars($cmessage); if($_POST["morning"] && $_POST["afternoon"]) $shift_for_message = "Both";if($_POST["morning"] && !$_POST["afternoon"]) $shift_for_message = "Morning";if(!$_POST["morning"] && $_POST["afternoon"]) $shift_for_message = "Afternoon";$body = "Name: ".$coded_name."\n\nPhone: ".$coded_phone."\n\nAddress: \n".$coded_address."\n".$coded_city."\n\nHobbies or Interests:\n".$coded_interests."\n\nMorning or Evening Shift?: ".$shift_for_message."\n\nWhy you choose to volunteer at Desert Manna:\n".$coded_message;$to = "myemail@mydomain.net";$subject = "Volunteer Application";mail($to, $subject, $body);?>Here's my problem. Everytime I use this script I get two emails. The first email contains all of the information in the $body variable, except the embedded variables are just blank. The email looks like this:Name:Phone:etc...The second email is works as planned.If anyone can help me with this I would greatly appreciate it! Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted August 23, 2006 Share Posted August 23, 2006 Can you post the script that writes out the form? It sounds like you're sending an email before the form is filled in. But without seeing more code, it is impossible to determine what's wrong.Ken Quote Link to comment Share on other sites More sharing options...
vivefree Posted August 23, 2006 Author Share Posted August 23, 2006 Here is the full code for each page in .rtf (text) form:1. Page with the form - http://desertmanna.org/junk/1.rtf2. The php page that sends the email - http://desertmanna.org/junk/2.rtfHave at it! Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted August 23, 2006 Share Posted August 23, 2006 It would have been much better if you had posted the sources here in the forum.Just paste each into a message and surround the code with the [b][nobbc][code][/code][/nobbc][/b] tags.Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.