Jump to content

Please help with send form


kt83

Recommended Posts

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!

 

 

Link to comment
https://forums.phpfreaks.com/topic/161899-please-help-with-send-form/
Share on other sites

""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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.