Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi I have set up a simple entry form, and I am submiting it using PHP to my email address, It works well when you fill the form in and send it, I receive the email however the email only displays the questions and not the answers that have been filled in on the form. Itss driving me crazy as top why this is not working. Can someone please help?
here is my form code, both form and PHP. Thanx
[syntax="html"]
<form
action='process.php' method="POST" name="survey" id="survey"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="19%"><p>First Name</p></td>
<td colspan="2" valign="top"><input name="q1" type="text" id="1" size="40" /></td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td><div align="left">
<p>Family Name</p>
</div></td>
<td colspan="2" valign="top"><input name="q2" type="text" id="2" size="40" /></td>
</tr>
<tr>
<td><div align="left"></div></td>
<td colspan="2"> </td>
</tr>
<tr>
<td valign="top"><div align="left">
<p>Address</p>
</div></td>
<td colspan="2" valign="top"><textarea name="q3" cols="40" rows="5" id="3"></textarea></td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td><div align="left">
<p>Email address</p>
</div></td>
<td colspan="2"><div align="left">
<input name="q4" type="text" id="4" size="40" />
</div></td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td><div align="left">
<p>Contact Tel. No</p>
</div></td>
<td colspan="2" valign="top"><input name="q5" type="text" id="5" size="40" /></td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td valign="top"><div align="left"> Magazine (where you saw the competition) </div></td>
<td colspan="2" valign="top"><input name="q6" type="text" id="6" size="40" /></td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td><div align="left"></div></td>
<td width="10%" valign="top"><div align="left">
<input type="submit" name="Submit" alt="Submit the survey!" value="Submit" />
</div></td>
<td width="71%" valign="top"><div align="left"><a href="http://www.persil.co.uk"><img src="logo.jpg" width="88" height="75" border="0" /></a></div></td>
</tr>
<tr>
<td><div align="left"></div></td>
<td colspan="2"> </td>
</tr>
</table>
</form>
Code: Select all
<?php
$result = "Winpersil.com competition entry\r\n\r\n";
$result .= "First Name: " . $q1 . "\r\n";
$result .= "Family Name: " . $q2 . "\r\n";
$result .= "Address: " . $q3 . "\r\n";
$result .= "Email address: " . $q4 . "\r\n";
$result .= "Contact Tel No.: " . $q5 . "\r\n";
$result .= "Magazine (where you saw the competition): " . $q6 . "\r\n";
if ($q4) {
$headers = "From: $name <$email>\r\n\r\n";
} else {
$headers = "From: No Name given <anonymous@yourserver.com>\r\n\r\n";
}
$sendit = mail("shushil@freshlemon.co.uk", "Winpersil.com competition entry", $result, $headers) or die("Something went wrong");
echo "<meta http-equiv='refresh' content='0; url=thank.htm'>";
die;
?>
thanxfeyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]