Page 1 of 1

Need help with feedback form

Posted: Tue Nov 08, 2005 10:27 am
by KevinCB
Hi

I've created a feedback form which sends an e-mail containing the data entered into the form, and would like to know if I can change the way that the contents of the form are inserted into an e-mail.

Here's part of the e-mail generated by the php:
Users name: Kevin B
Business Name: Test
Address: 56 Milton Road
Crewe
Cheshire

Postcode: CW2 6FG
Telephone No: 01270 586790
Is it possible to get the address part to have the next line underneath the other so that they are inline?

Here's the php script I'm using:

Code: Select all

<?php if (isset($_POST['submit_form'])) // if the form was sent do the following
{ 
	$name = $_POST['name'];
	$busname = $_POST['busname'];
	$addr = $_POST['addr'];
	$postcode = $_POST['postcode'];
	$tel = $_POST['tel'];
	$email = $_POST['email'];
	$nature = $_POST['nature'];
	$msg = $_POST['msg'];
	$about = $_POST['about'];
	
	$headers = 'From: '.$name.' <'.$email.'>' . "\r\n" .
			'Reply-To: '.$email.'' . "\r\n" .
			'X-Mailer: PHP/' . phpversion();
		
	$message = 'Name: '.$name."\n"
			   .'Business Name: '.$busname. "\n"
			   .'Address: '.$addr. "\n\n"
			   .'Postcode: '.$postcode. "\n"
			   .'Telephone No: '.$tel. "\n"
			   .'E-mail Address: '.$email. "\n\n"
			   .'Feedback Comments: '.$msg. "\n";

	mail("you@yourmailaddress.com","::: Feedback :::","$message","$headers") or die("email error");
	echo '<br />Thank you for your message!'; // if all went well, display message was sent

} // end php submission code ?>
Thanks

Posted: Tue Nov 08, 2005 10:48 am
by feyd
the line with Address in it, remove the second \n

Posted: Tue Nov 08, 2005 11:59 am
by KevinCB
That's not really what I wanted, let me explain it a little better.

The following is how it comes out:
Users name: Kevin B
Business Name: Test
Address: 56 Milton Road
Crewe
Cheshire

Postcode: CW2 6FG
Telephone No: 01270 586790
But I would like it inline as follows (the x's represent spaces, I had to put them in to space it across):
Users name: Kevin B
Business Name: Test
Address: 56 Milton Road
xxxxxxxxCrewe
xxxxxxxxCheshire

Postcode: CW2 6FG
Telephone No: 01270 586790
Is this possible?

Posted: Tue Nov 08, 2005 12:06 pm
by Grim...
CSS would be the best way.

Posted: Tue Nov 08, 2005 12:52 pm
by Luke
Why don't you just do this...

Code: Select all

Address:
Whatever
Whatever
Whatever
If you want the address lines lined up.
I don't really understand why you would need that in an email... but oh well.
If you want to, you can set the mail headers to send in html format, so you can just format the email like a web page. That would work too.