Hi.
Could I please get some help with this, I have never used PHP before (hardly), and I have this contact form that doesn't work.
The form was made in dreamver cs4, and the input boxes are named: your_email, your_name and message. Here is the external php script.
<?php
$your_name = "your_name";
$your_email = "your_email";
$message = "message";
$header = "from: $your_name <$your_email>";
$to = "contact_form@keycutwebdesign.com.au";
$send_email=mail($to,$header,$message);
header( "Location: http://www.mysite.com.au/thankyou.html" );
?>
I know that the php works to some extent, because it loads the thankyou page in the header. However, my inbox isn't recieving emails.
Could someone please help me? total n00b i am
Need help with contact form - n00b
Moderator: General Moderators
-
jase_thomas
- Forum Newbie
- Posts: 2
- Joined: Sat Nov 28, 2009 4:13 am
Re: Need help with contact form - n00b
Hey I have one you can use just add Your Email... see for youremail@youremail.com
Save it in php and run it...
Save it in php and run it...
Code: Select all
<html>
<body>
<div style="position: absolute; top: 300px; left: 250px; width: 240px; height: 150px;">
<?php
function spamcheck($field)
{
//filter_var() sanitizes the e-mail
//address using FILTER_SANITIZE_EMAIL
$field=filter_var($field, FILTER_SANITIZE_EMAIL);
//filter_var() validates the e-mail
//address using FILTER_VALIDATE_EMAIL
if(filter_var($field, FILTER_VALIDATE_EMAIL))
{
return TRUE;
}
else
{
return FALSE;
}
}
if (isset($_REQUEST['email']))
{//if "email" is filled out, proceed
//check if the email address is invalid
$mailcheck = spamcheck($_REQUEST['email']);
if ($mailcheck==FALSE)
{
echo "Invalid input. Please try again..";
}
else
{//send email
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail("youremail@youremail.com", "Subject: $subject",
$message, "From: $email" );
echo "Thank you for using our mail form. We will contact you in the next 24 hours";
}
}
else
{//if "email" is not filled out, display the form
echo "<form method='post' action='contact.php'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='5' cols='25'>
</textarea><br />
<input type='submit' />
</form>";
}
?>
</body>
</html>
-
jase_thomas
- Forum Newbie
- Posts: 2
- Joined: Sat Nov 28, 2009 4:13 am
Re: Need help with contact form - n00b
Thanks mate.
It seems that if the php is external, than the variables need to be set using a $_request function. Is this right?
Thanks for your help!
It seems that if the php is external, than the variables need to be set using a $_request function. Is this right?
Thanks for your help!