Page 1 of 1

Help please Send Php form Problem!

Posted: Tue Mar 23, 2010 3:40 pm
by paultechdocs
Hi ive made a form with dreamweaver and i want to send the information that i recolect from users.and far away is sending me the message ,but not all info from all the textfield that i have i dont receive name , and i have this sendform.php

Code: Select all

<?php
$to = "paultechdocs@aol.com";
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$phone = $_REQUEST['phone'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }
?>
ive validate my form,ive chaeck the textfield if they are realitionate with the script. i receive the message,but not all the request textfields that i ave.wheres is the problem and what i have to change on my form to make works all the texfield that i put on, or i add. customize my script.
thank you

Re: Help please Send Php form Problem!

Posted: Tue Mar 23, 2010 4:59 pm
by mikosiko

Code: Select all

<?php
$to = "paultechdocs@aol.com";
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$phone = $_REQUEST['phone'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }
?>
....not all info from all the textfield that i have i dont receive name
you are not using those variables in any place here $sent = mail($to, $subject, $message, $headers)

read here : http://php.net/manual/en/function.mail.php

Re: Help please Send Php form Problem!

Posted: Sat Mar 27, 2010 7:57 am
by stevenpepe
You are not adding your variables to your mail function.

Try setting all variables after $subject to one variable name, such as $body, and don't forget to add the dot before the equal sign to join them as one variable. See my example.

$body = $_REQUEST['name'] ;
$body .= $_REQUEST['phone'] ;
$body .= $_REQUEST['email'] ;

Then include $body as a parameter in your mail function

$sent = mail($to, $subject, $body, $message, $headers) ;

This should do it for you.

Steve