Forum Moderators: coopster

Message Too Old, No Replies

Sendmail

easy php script but i need an advice...

         

Cecilia

5:57 am on Nov 1, 2004 (gmt 0)



Can anyone help me with this:
I have a very simple form that has to be sent to an email.
I have 3 fields:
Full Name
Email
One option

I found a php script and it works, it sends the results to my email, except for one field. I can only receive 2 fields while I need ot recive teh 3 of them.

I tried many combinations and each time, when I move things around, one of the fields is missing:

ok here is the short php script:

<?php
$email = $_REQUEST['email'] ;
$fullname = $_REQUEST['fullname'] ;
$breed = $_REQUEST['breed'] ;

mail( "somename@example.com", "Feedback Form Results",
$fullname, "From: $email" );
header( "Location: [example.com...] );
?>

If I add $breed, it does not show the email of the person filling the survey anymore. Why only one field $fullname or $breed works and not both?

Thanks for your help.
Cecile

[edited by: coopster at 1:23 pm (utc) on Nov. 1, 2004]
[edit reason] generalized url per TOS [webmasterworld.com] [/edit]

charlier

7:04 am on Nov 1, 2004 (gmt 0)

10+ Year Member



I think your parameters to mail may be a bit mixed up. The documentation says: (http://www.php.net/manual/en/function.mail.php)

bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]])

and on of the examples is:

mail("somebody@example.com", "the subject", $message,
"From: webmaster@{$_SERVER['SERVER_NAME']}\r\n" .
"Reply-To: webmaster@{$_SERVER['SERVER_NAME']}\r\n" .
"X-Mailer: PHP/" . phpversion());

so perhaps your mail call should look a bit like:

$email = $_REQUEST['email'] ;
$fullname = $_REQUEST['fullname'] ;
$breed = $_REQUEST['breed'] ;

$message = "Fullname: $fullname\nBreed: $breed";
mail( "somebody@example.com", "Feedback Form Results",
$message, "From: $email" );

header( "Location: [example.com...] );

Welcome to Webmaster World

[edited by: coopster at 1:29 pm (utc) on Nov. 1, 2004]
[edit reason] generalized url [/edit]