Contact u form error
Posted: Wed Sep 22, 2010 6:17 am
I was trying to create php based contact us form using only php.
I created following files but i was not able to submit the form. Please suggest me where I am going wrong.
Also I just want to use php. No java or other script.
Here is the code that i used
other file is just a thank you file
thnaks
I created following files but i was not able to submit the form. Please suggest me where I am going wrong.
Also I just want to use php. No java or other script.
Here is the code that i used
Code: Select all
<?php
if(isset($_POST['$name']))
{
$_POST['$name'];
$_POST['$contact'];
$_POST['$email'];
$_POST['$query'];
$from="$email";
$to="support@yoursitename.com";
$subject="Query from the site";
$message=" $name contacted you
his contact number is $contact
his email is $email
They inquired of
$query
";
$headers = "From: $from\r\n";
$headers .= "Content-type: text\r\n";
mail($to, $subject, $message, $headers);
$msgToUser = "Thanks for contacting We Will get back to you soon
Admin
support@yoursitename.com";
include_once 'thanks.php';
}
else
{
$name="";
$contact="";
$email="";
$query="";
}
?>
<!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>Untitled Document</title>
</head>
<body>
<form action="contact.php" method="post">
<p style="margin-bottom: -10">Your name: <input type="text" name="name" size="64"></p>
<p style="margin-bottom: -10">Your email: <input type="text" name="email" size="59"></p>
<p style="margin-bottom: -10">Contact Number: <input type="text" name="contact" size="20">
</p>
<p style="margin-bottom: -10">Comments:</p>
<p style="margin-bottom: -10"><textarea name="query" rows="10" cols="40"></textarea></p>
<p style="margin-bottom: -10"></p>
<input name="Submit" type="submit" value="Submit">
</form>
</body>
</html>
thnaks