I can only get four variable sent to my email. Not the rest?

Hello,

I am writing my first php script (of course) and it works except it only shows 4 variables.
Example I have it to send me:
mail($myemail, $fullname, $email, $message, $phone);
But it will only send me the first four no matter what order they are in. It’s driving me crazy. I can’t think or find any reason why it would do this.

If I change it to
mail($myemail, $fullname, $email, $phone, $message);
It will send me everything but $message
if I change it to
mail($myemail, $fullname, $message, $email, $phone );
It will send me everything but $phone

Does anyone know why or what I need to change? I apologize if this sounds like a dumb question. I am very very new to php.

Thank you for any guidance you can give. Here is the code:
HTML:

<form action="Contact.php" method="post" id="contact" name="contact" style="margin:0px";>
<h2>Contact Form:</h2>
<p>Fields marked (<span style="color:#F00;">*</span>) are required.</p>

<label for="text_fullname">Full Name<span style="color:#F00;">*</span>:</label>
<input name="fullname" type="text" class="input" id="fullname" tabindex="1" />
<label for="text_email">Email<span style="color:#F00;">*</span>:</label>
<input name="email" type="text" class="input" id="email" tabindex="2" />

<label for="text_phone">Phone:</label>
<input name="phone" type="text" class="input" id="phone" tabindex="3" />

<label for="text_comments">Message/Comment:</label>
<textarea name="message" cols="23" rows="3" class="input" id="message" tabindex="4"></textarea>
<br>

<div style="padding-left:200px;">
<button type="submit" id="send" name="send">Send!</button> &nbsp;&nbsp; <button type="reset">Reset</button>
</div>

</form>

PHP:

<?php
/* Set e-mail recipient */
$myemail = "myemailaddress@gmail.com";

$fullname = $_POST['fullname'] ;
$email = $_POST['email'] ;
$phone = $_POST['phone'] ;
$message = $_POST['message'] ;

mail($myemail, $fullname, $email, $message, $phone);
header( "Location: http://www.ppm-oc.com/thankyou.html" );
?>

Thank you

I do something like this:

mail ($myemail, $subject, $body, "From: \\"$fullname\\" <$email>" . "\\r\
" . "Reply-To: \\"$fullname\\" <$email>");

Then you set the $body variable somewhat like this:

$body = 
	"Name of sender: $fullname\
\
" .
	"-----------------------------------------------------------\
\
" .
	"Email of sender: $email\
\
" .
	"-----------------------------------------------------------\
\
" .
	"Telephone of sender: $phone\
\
" .
	"-----------------------------------------------------------\
\
" .
	"Message:\
\
" .
	"$message" ;

So, most of the info you collect is carried by the $body variable, and this is what appears in the body of the email sent to you.

in addition, this tutorial on how to send plain text emails, HTML emails and emails with attachments might help.

I was also told I can’t use phone as a parameter and it should look more like this:

<?php
$to = ‘nobody@example.com’;
$subject = ‘the subject’;
$message = ‘hello’;
$headers = ‘From: webmaster@example.com’ . "\r
" .
‘Reply-To: webmaster@example.com’ . "\r
" .
‘X-Mailer: PHP/’ . phpversion();

mail($to, $subject, $message, $headers);
?>

I so appreciate your advice! I will get back this post and let you know.

Thank you Ralph.m! That was very helpful. This is what I ended up with that worked. I tried SO many different ways. So I’m not sure if my code is correct or sloppy, but it does work:

<?php
$myemail = “mymail@gmail.com”;

$fullname = $_POST[‘fullname’] ;
$email = $_POST[‘email’] ;
$phone = $_POST[‘phone’] ;
$message = $_POST[‘message’] ;

$msg = 'Name: '.$fullname."
“;
$msg .= 'Email: '.$email.”
“;
$msg .= 'Phone: '.$phone.”

“;
$msg .= 'Message: '.$message.”
";

mail($myemail, ‘New message from contact form’, $msg);
header( “Location: http://www.ppm-oc.com/thankyou.html” );
?>

That looks OK, although this

$msg = 'Name: '.$fullname."\
";
$msg .= 'Email: '.$email."\
";
$msg .= 'Phone: '.$phone."\
\
";
$msg .= 'Message: '.$message."\
";

could be simplified to this:

$msg = 
    "Name: $fullname\
" .
    "Email: $email\
" . 
    "Phone: $phone\
\
" . 
    "Message: $message\
";

ahhhh… I see. Thank you. I will shorten that!

Thanks a million and 10!!!