Hey all,
I am trying to get my sendmail.php to send the name and phone number also but its just sending the comments… I know its something super simple I am missing. Can someone please look and let me know what it is.
Any help would be appreciated.
<?php
$to = "me@myemail.com";
$subject = "Contact Us Form";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$phone = $_REQUEST['phone'] ;
$comments = $_REQUEST['comments'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $name, $phone, $comments, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }
?>
I would like it to be like this, but not sure how the html would look.
<?php
$yourname = $_POST['yourname'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$comments = $_POST['comments'];
$mailmsg = "Users name is $yourname and phone number is $phone <br> email address : $email <br> users msg: $comments";
if($_POST) {
print $mailmsg;
//print function will show us did we really stored values from our FORM fields or not
//mail('youremailaddress@gmail.com',"aj php form", $mailmsg);
}
?>