Forum Moderators: coopster

Message Too Old, No Replies

please help tidy this up....

i need a bit of help tidying up this script...

         

keentolearn

9:35 am on Jun 19, 2005 (gmt 0)

10+ Year Member



Hi All

I am using the below code, it process the email fine. But the results a just listed one below the other. I would like to add a link break between the contact details and enquirey detail and add a title to each price of date ie

Name =" date here "
Address = " date here "
<br><br>
Enquiry =" data here "

Here is the php
============
<?
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$phone = $_REQUEST['phone'] ;
$fax = $_REQUEST['fax'] ;
$address = $_REQUEST['address'] ;
$enquiry = $_REQUEST['enquiry'] ;
$desktops = $_REQUEST['desktops'] ;
$laptops = $_REQUEST['laptops'] ;
$modems = $_REQUEST['modems'] ;
$printers = $_REQUEST['printers'] ;
$scanners = $_REQUEST['scanners'] ;
$harddisks = $_REQUEST['harddisks'] ;
$memory = $_REQUEST['memory'] ;
$diskwiping = $_REQUEST['diskwiping'] ;
$networking = $_REQUEST['networking'] ;
$collection = $_REQUEST['collection'] ;

$recipient = "info@theurl.com";
$subject = "WebSite Contact Page Feedback";

$message = "
$name
$email
$phone
$fax
$address
$enquiry
$desktops
$laptops
$modem
$printer
$scanner
$harddisks
$memory
$diskwiping
$networking
$collection
";

$extra = "From: $email";

mail( "info@theurl.com", "WebSite Contact Page Feedback",
$message, "From: $email", "-fuser@info@@theurl.com" );
header( "Location: [theurl...] );

?>

======================

the items below the ENQUIRY are checkboxs on the form.

Thanks for any help with this..

as ever
keen to learn..

dreamcatcher

9:56 am on Jun 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use \n for your line breaks. ie:

$name . "\n" .
$email . "\n" .

keentolearn

10:39 am on Jun 19, 2005 (gmt 0)

10+ Year Member



Hi

thanks for that - but im getting this error:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/fptusername/public_html/dev_folder/formprocess.php on line 23

Parse error: parse error, unexpected T_STRING in /home/ftpusername/public_html/dev_folder/formprocess.php on line 23

any ideas?

Thanks for the help
as ever
keen to learn

dreamcatcher

11:47 am on Jun 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can you post the code thats giving you the problem?

keentolearn

1:25 pm on Jun 19, 2005 (gmt 0)

10+ Year Member



hi

yes please see below....

<?
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$phone = $_REQUEST['phone'] ;
$fax = $_REQUEST['fax'] ;
$address = $_REQUEST['address'] ;
$enquiry = $_REQUEST['enquiry'] ;
$desktops = $_REQUEST['desktops'] ;
$laptops = $_REQUEST['laptops'] ;
$modems = $_REQUEST['modems'] ;
$printers = $_REQUEST['printers'] ;
$scanners = $_REQUEST['scanners'] ;
$harddisks = $_REQUEST['harddisks'] ;
$memory = $_REQUEST['memory'] ;
$diskwiping = $_REQUEST['diskwiping'] ;
$networking = $_REQUEST['networking'] ;
$collection = $_REQUEST['collection'] ;

$recipient = "info@theurl.com";
$subject = "WebSite Contact Page Feedback";

$message = "
$name . "\n" .
$email
$phone
$fax
$address
$enquiry
$desktops
$laptops
$modem
$printer
$scanner
$harddisks
$memory
$diskwiping
$networking
$collection
";

$extra = "From: $email";

mail( "info@theurl.com", "WebSite Contact Page Feedback",
$message, "From: $email", "-fuser@info@@theurl.com" );
header( "Location: [theurl...] );

?>

i added the . "\n" . to the first $name to test it.

any idea on adding a title to email also
ie:
name =
address =

thanks for your time on this
as ever
keen to learn..

dreamcatcher

2:12 pm on Jun 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try formatting it like this:

$message = "Name: " . $name . "\n";
$message .= "E-Mail: " . $email . "\n";

etc etc

keentolearn

5:19 pm on Jun 19, 2005 (gmt 0)

10+ Year Member



Hi Again

Sorry - but im getting this....

Parse error: parse error, unexpected T_STRING in /home/ftpusername/public_html/dev_folder/formprocess.php on line 24

line 24 is....

$message = "Name: " . $name . "\n";

the first line of the $message

any ideas
thanks for your time
keen to learn

dreamcatcher

8:49 pm on Jun 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That lines fine so the parse error must be from somewhere else.

dc

mcibor

8:59 pm on Jun 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is the code for whole message:

$message = "Name: $name\nEmail: $email\n Phone: $phone\nFax: $fax\n";
$message .= "Address: $address\n\nEnquiry: $enquiry\nDesktops: $desktops\n";
$message .= "Laptops: $laptops\nModem: $modem\nPrinter: $printer\nScanner: $scanner\n";
$message .= "Harddisks: $harddisks\nMemory: $memory\nDiskwiping $diskwiping\n";
$message .= "Networking: $networking\nCollection: $collection";

This will give you a line break (see the double \n\n) before Enquiry.

You can do it also manually by putting that enter there (enter and \n is the same)

In your 3rd post it wasn't working because you ended string and then put \n (it has to be in the string. I mean you have there: $a = "bla $string."\n"... and it should be $a = "bla ".$string."\nbla";
Notice, that I don't put space after \n. If you put space there your next line will start with space - and that you don't want.

Hope this helps
Michal Cibor

keentolearn

4:01 am on Jun 20, 2005 (gmt 0)

10+ Year Member



Hi dreamcatcher and mcibor.

Sorry for the repeated cries for help and thank you for taking the time to put me right.

it works great now - im going to have to learn much more about php!

best wishes
as ever
keen to learn..