Form - php - email...Help!!
Out of context: Reply #2
- Started
- Last post
- 7 Responses
- designer1010
This is the full php code. I downloaded this from some site. I don't know how to hard code it myself.
<?php
/* Set e-mail recipient */
$myemail = "email here";/* Check all form inputs using check_input function */
$yourname = check_input($_POST['yourname'], "Enter your name");
$companyname = check_input($_POST['companyname'], "Enter your company name");
$location = check_input($_POST['location'], "Enter your location");
$email = check_input($_POST['email'], "Enter your email");
$contactnumber = check_input($_POST['contactnumber'], "Enter your phone number");$enquirys = check_input($_POST['enquirys'], "Enter the area of enguiry");
$comments = check_input($_POST['comments'], "Write your comments");$emailcontact = check_input($_POST['emailcontact... ;
$phonecontact = check_input($_POST['phonecontact... ;
/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
show_error("E-mail address not valid");
}/* Let's prepare the message for the e-mail */
$message = "Hello!Your contact form has been submitted by:
Name: $yourname
Company Name:Location: $location
E-mail: $email
Contact Number: $contactnumberArea of enguiry: $enquirys
Comments:
$commentsContact method:
$emailcontact
$phonecontactEnd of message
";/* Send the message using mail() function */
mail($myemail, $subject, $message);/* Redirect visitor to the thank you page */
header('Location: thanks.html');
exit();/* Functions we used */
function check_input($data, $problem='')
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
{
show_error($problem);
}
return $data;
}function show_error($myError)
{
?>