kt83 Posted June 12, 2009 Share Posted June 12, 2009 Hi, I've created a survey but cannot get it to send the results to an email address. I know for sure it did work on the first try but for some reason when I tried to send it again without making any changes to it it wouldn't send. Could anyone tell me if this looks right? FYI: The "id=contactform" that I use is a contact for I created for the feedback page. I wonder if I'd have to create a different one for the survey... //PHP FOR SENDING SURVEY RESULTS TO EMAIL////////////////////////// if( isset($_POST["btnSubmit"]) ){ { ${$var} = $val; } $body_body .= " Gender: | " . $gender . "\n"; $body_body .= " Age Group: | " . $age . "\n"; $to = 'Admin <email>'; $subject = 'Survey Results'; $body = $body_body; mail($to, $subject, $body); } /////END OF PHP///// /////TPL FILE///// <form method="post" id="contactForm"> <b>What is your gender?</b> <br /><br /> <table border="0"> <tr> <td><input type="radio" name="gender" value="male"> Male </td> </tr> <tr> <td><input type="radio" name="gender" value="female"> Female</td> </tr> </table> <br /><br /> <b>What is your age group?</b> <br /><br /> <table border="0"> <tr> <td><input type="radio" name="age" value="under20" /> Under 20 </td> </tr> </table> <br /><br /> <input type="submit" value="submit" name="submit" /> </form> ////END OF TPL//// Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/161899-please-help-with-send-form/ Share on other sites More sharing options...
haku Posted June 12, 2009 Share Posted June 12, 2009 "Admin <email>" is not an email address. Quote Link to comment https://forums.phpfreaks.com/topic/161899-please-help-with-send-form/#findComment-854208 Share on other sites More sharing options...
kt83 Posted June 12, 2009 Author Share Posted June 12, 2009 ""Admin <email>" is not an email address." Thanks for noticing, but I only put that there for this purpose. I have a real email address in place of that. I think the problem lies somewhere in here: if( isset($_POST["btnSubmit"]) ){ { ${$var} = $val; } or in here: <form method="post" id="contactForm"> Do I need the "id="contactForm"" in there? I tried it without that and it didn't work. What is the relationship between the contactForm and the mailto email address? Quote Link to comment https://forums.phpfreaks.com/topic/161899-please-help-with-send-form/#findComment-854257 Share on other sites More sharing options...
Dathremar Posted June 12, 2009 Share Posted June 12, 2009 <form method="post" id="contactForm" action="file_to_do_action"> Think You should add action on Your form Quote Link to comment https://forums.phpfreaks.com/topic/161899-please-help-with-send-form/#findComment-854277 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.