...

View Full Version : need help with simple email form



iamalex
11-05-2006, 09:26 PM
Please help. Below works, but that is only with message.

How do I add name, address, city so they work and are included in email.
New to php and everything I try does not get work.

Thanks


< ?
$email = $_GET['email'] ;
$message = $_GET['message'] ;
mail( "yourname@example.com", "Email Subject", $message, "From: $email" );
print "Congratulations your email has been sent";
?>

littlejones
11-05-2006, 11:39 PM
I would set the form method="post" and where the message goes put something along the lines of...




<?php

$email = $_POST['email'] ;
$message = $_POST['message'] ;
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];

mail( "yourname@example.com", "Email Subject", $name."<br/>".$address."<br/>".$city."<br/><br/>".$message, "From: $email" );
print "Congratulations your email has been sent";

?>



Alternatively you could use /n for line breaks within the code. It's really up to you.

iamalex
11-06-2006, 03:34 AM
Thank you so much!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum