Im trying to setup a php contact form.
I created a html and the php file the whole process works except for when i receive a message it only states the subject with no name,no email,no body.
I was told i have to put everything into one variable.
Does anyone know how to do this?
Thanks
This is my PHP code
<?php
$name = $_post['name'];
$email = $_post['email'];
$comments = $_post['comments'];
//TO, Subject, Message, Header
mail('[email protected]', 'Comments', $text, 'From: '.$name.' '.$email.'>');
header('Location: thankyou.html');
?>
This is my HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Contact Form</title>
</head>
<body>
<form action="contactus2.php" method="post">
name<br/><input type="text" name="name" /><br/>
email<br/><input type="text" name="email" /><br/>
comments<br><textarea row="4" cols="38" name="comments"></textarea><br/>
<input type="submit" value="Submit"/>
</form>
</body>
</html>
I created a html and the php file the whole process works except for when i receive a message it only states the subject with no name,no email,no body.
I was told i have to put everything into one variable.
Does anyone know how to do this?
Thanks
This is my PHP code
<?php
$name = $_post['name'];
$email = $_post['email'];
$comments = $_post['comments'];
//TO, Subject, Message, Header
mail('[email protected]', 'Comments', $text, 'From: '.$name.' '.$email.'>');
header('Location: thankyou.html');
?>
This is my HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Contact Form</title>
</head>
<body>
<form action="contactus2.php" method="post">
name<br/><input type="text" name="name" /><br/>
email<br/><input type="text" name="email" /><br/>
comments<br><textarea row="4" cols="38" name="comments"></textarea><br/>
<input type="submit" value="Submit"/>
</form>
</body>
</html>