slice16
11-01-2004, 12:44 PM
Im just learning PHP now, and im trying to create a nice simple form that allows people to contact me.
They enter there name,
Email address,
select a topic and types in a message. Then when they click submit i would like it to send these details to me via email.
How will i go about getting this to work?
xgoth3
11-01-2004, 01:44 PM
Hi.
You may find lots of scripts to send mail with PHP in http://www.hoscripts.com
agruetz
11-01-2004, 02:32 PM
Here is some code that will do it if you wish it to be posted from a form create your html form and the names of the texts feilds are the names of the varibles is <input type="text" name="var" value=""></input> count be accessed via the php script like $_POST['var'] or $_GET['var'] if you use the get method of form posting and not post:
<?
$basemail = "sending from address here";
//e-mails user a copy of the ticket for later response
$mailheader = "Return-Path: <$basemail>\r\n"
."From: $basemail\r\n"
."Reply-To: $basemail\r\n";
$to = "sending to address here";
$subject = "your subject here";
$message="your message here";
$error = mail($to,$subject,$message,$mailheader);
if ($error != true)
{
print "email not sent\n";
} else
{
print "email sent\n";
}
?>
Also look up the mail function at php.net
slice16
11-01-2004, 02:34 PM
thanks ive got it working now tho... cheers again :D