Simple php form that doesnt want to work!
Posted: Wed Oct 04, 2006 6:20 am
JayBird | Please use
The code for formtoemail_friend.php is:
JayBird | 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]
Hi. I have been trying to set up a simple form for a little while now. It is basically to allow people to tell a friend about a website. There is an error every time i try, can someone please let me know what I have done wrong!
The form code is:Code: Select all
<p><img border="0" src="images/tell_a_friend.png" width="423" height="24"></p>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td width="100%"><p>Pass the word on, tell other people about Spoken Groove!</p>
<p>
<form action="formtoemail_friend.php" method="post">
<table border="0" cellspacing="5">
<tr><td align="left"><p>Your Name:</p></td><td align="left">
<input type="text" size="36" name="Name"></td></tr>
<tr><td align="left"><p>Your Email address:</p></td><td align="left">
<input type="text" size="36" name="Email"></td></tr>
<tr><td align="left"><p>Friends Name:</p></td><td align="left">
<input type="text" size="36" name="FName"></td></tr>
<tr><td align="left"><p>Friends Email address:</p></td><td align="left">
<input type="text" size="36" name="FEmail"></td></tr>
<tr><td valign="top" align="left"><p>Message:</p></td><td align="left">
<textarea name="Message" rows="6" cols="30"></textarea></td></tr>
<tr><td align="left"> </td><td align="left"><input type="submit" value="Send"></td></tr>
</table>
</form>
</td>
</tr>
</table>The code for formtoemail_friend.php is:
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Spoken Groove</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en-uk">
</head>
<body bgcolor="#ffffff" text="#000000">
<div>
<center>
<p><font face="arial" size="2"><a href="index.php?location=thanks_friend">Click here to continue</a></font></p>
</center>
</div>
</body>
</html>
<?php
$name=$_post['Name'];
$email=$_post['Email'];
$fname=$_post['FName'];
$femail=$_post['FEmail'];
$message=$_post['Message];
$msg="$name says: $message;
$subject = "Spoken Groove";
$headers = "From: $email \r\n";
$headers .= "Reply-To: $email \r\n";
$headers .= "Return-Path: $email \r\n";
mail($femail, $subject, $msg, $headers);
?>JayBird | 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]