View Full Version : Form sending in PHP Problem


Ichpuchtli
08-06-06, 02:39 AM
Well the thing is I can only get the message to send.

<?
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$name = $_REQUEST['name'] ;
$name2 = $_REQUEST['name2'] ;
mail( "andy@ichpuchtli.com", "Form Thing.",
$message, $name, $name2, "From: $email" );
header( "Location: http://www.ichpuchtli.com/forms/thankyou.html" );
?>

Well the only things that work is it sends me an email saying "Form Thing" As the subject, the email adress is also in the right place it says it is from that person. All things in Red are working I need it to send the name, and name2.

Thanks Andrew

HighFunctioning
08-06-06, 10:12 AM
http://us2.php.net/function.mail

The mail function accept up to 5 args, and is like:
bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )

So, basically, you need to place $name and $name2 inside your message body. Suppose $name and $name2 were first and last name respectively:

$message = "Hello!\r\nYou have just received a message from $_REQUEST['name'] $_REQUEST['name2'].\r\nHere it is:\r\n $_REQUEST['message']";

And then, the mail function can be used as:
mail("xxxx@xxxxx", "subject", $message, "From: $email");

If there's anything wrong here, I apologize... I don't program in PHP very often!
HTH

Ichpuchtli
08-15-06, 03:53 AM
No I think it seems to be working for now. What do you usally programm in?

HighFunctioning
08-15-06, 09:58 AM
Well.... I don't really do web development, so my experience with PHP is quite hit and miss. I mostly deal with C++ and I also do some things with VBA (Visual Basic for Applications), and for basic scripting, I use Perl.