Form to email php help please

Hi there, I am trying to get a form to email the responses typed into it. I have almost sorted it but i cannot get it to send the contents of two text boxes. The fields for name, email, title and agency work fine as does the one for comments. But I need another box, the same as but above, the comments one for addresses. I have commented out some of my efforts but cannot seem to sort it. Could someone please have a look and let me know what I am missing? TIA



//start

$headersep = (!isset( $uself ) || ($uself == 0)) ? "
" : "
" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$job = $_POST['job'] ;
$agency = $_POST['agency'] ;
// $address = $_POST['address'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
	header( "Location: $formurl" );
	exit ;
}
if (empty($name) || empty($email) || empty($job) || empty($agency) || empty($address) || empty($comments)) {
   header( "Location: $errorurl" );
   exit ;
}
if ( ereg( "[
]", $name ) || ereg( "[
]", $email ) || ereg( "[
]", $job) || ereg( "[
]", $agency)) {
	header( "Location: $errorurl" );
	exit ;
}

// if (get_magic_quotes_gpc()) {
//	$address = stripslashes( $address ); 
// }

//if (get_magic_quotes_gpc()) {
//	$address = stripslashes( $address ) || (get_magic_quotes_gpc()) $comments = stripslashes( $comments );
	
if (get_magic_quotes_gpc()) {
	$comments = stripslashes( $comments );
}

$messageproper =

	"This message was sent from:
" .
	"$http_referrer
" .
	"------------------------------------------------------------
" .
	"Name of sender: $name
" .
	"Email of sender: $email
" .
	"Job Title of sender: $job
" .
	"Agency of sender: $agency
" .
//	"------------------------- ADDRESS -------------------------

" .
//	$address .
//	"

------------------------------------------------------------
" ;
	
	"------------------------- COMMENTS -------------------------

" .
	$comments .
	"

------------------------------------------------------------
" ;

mail($mailto, $subject, $messageproper,
	"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );
header( "Location: $thankyouurl" );
exit ;

?>

If nobody sorts before I get home from work i’ll have a gander when I
get home in a couple of hours.

I would if my php install was not :censored: sorry can’t test :frowning:

however I would have thought that your message proper should look more like this…


$messageproper = "This message was sent from:
  $http_referrer

    ------------------------------------------------------------

    Name of sender: $name

    Email of sender: $email

    Job Title of sender: $job
 
    Agency of sender: $agency
 
    ------------------------- ADDRESS -------------------------


    $address 


    ------------------------------------------------------------

    
    ------------------------- COMMENTS -------------------------


    $comments 


    ------------------------------------------------------------
";

:thumbsup: Thank you PMM, It’s amazing what a difference a semi-colon in the wrong place makes.

Cheers for your help