Forum Moderators: coopster

Message Too Old, No Replies

parse error on php

unexpected T_STRING

         

keentolearn

2:55 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



Hi all

First post here - so please go easy on me....

i have edited a php script to pick up the data from a webform and convert it into a email and when i submit it i get a error.....

Parse error: parse error, unexpected T_STRING in /home/nas01l/f/flexamatic.com/user/htdocs/estore/sendmail9.php on line 6

the php is:

$q2 ="firstname: \n";
$q2 .="Request['firstname']\n

$q3 ="surname: \n";
$q3 .="Request['surname']\n

$q4 ="address: \n";
$q4 .="Request['address']\n

$q5 ="email: \n";
$q5 .="Request['email']\n

$q6 ="phone: \n";
$q6 .="Request['phone']\n

$q7 ="foundsiteby: \n";
$q7 .="Request['foundsiteby']\n

$q8 ="brochure: \n";
$q8 .="Request['brochure']\n

$q9 ="homedemo: \n";
$q9 .="Request['homedemo']\n

$q10 ="callback: \n";
$q10 .="Request['callback']\n

$message = $q1 . "\n" . $q2 . "\n" . $q3 . "\n" . $q4 . "\n" . $q5 . "\n" . $q6 . "\n" . $q7 . "\n" . $q8 . "\n" . $q9 . "\n" . $q10;

mail( "info@therealdomain.com", "WebSite Feedback",
$message, "From: $email", "-fuser@user@domainname.com" );
header( "Location: [therealdomain.com...] );
?>

any help would be appriated..

thanks
keen to learn..

Turbonutter

3:06 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



First 3 lines:

<?php
$q2 ="firstname: \n";
$q2 .="Request['firstname']\n

$q3 ="surname: \n";
?>

Now I'll re-arrange it a bit:

<?php
$q2 ="firstname: \n";
$q2 .="Request['firstname']\n $q3 ="surname: \n";
?>

Can you see the problem? Hint, the T_STRING is "surname: \n"

stuartc1

4:44 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



The problem is the missing closing double quotes, semi-colon and $ sign in every second line!

for example:
$q5 ="email: \n";
$q5 .="Request['email']\n

SHOULD BE:

$q5 ="email: \n";
$q5 .= $Request['email']."\n";

BTW, this looks nicer IMHO:

$q5 = "email: \\n ".$Request['email']."\\n";

keentolearn

5:08 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



Hi Thanks

i have edited as suggested the form submits ok, but the email doesnt contain the data, just this

title: \n \n
firstname: \n \n
surname: \n \n
address: \n \n
email: \n \n
phone: \n \n
foundsiteby: \n \n
brochure: \n \n
homedemo: \n \n
callback: \n \n

the php looks like this...

$q1 = "title: \\n ".$Request['title']."\\n";
$q2 = "firstname: \\n ".$Request['firstname']."\\n";
$q3 = "surname: \\n ".$Request['surname']."\\n";
$q4 = "address: \\n ".$Request['address']."\\n";
$q5 = "email: \\n ".$Request['email']."\\n";
$q6 = "phone: \\n ".$Request['phone']."\\n";
$q7 = "foundsiteby: \\n ".$Request'foundsiteby']."\\n";
$q8 = "brochure: \\n ".$Request['brochure']."\\n";
$q9 = "homedemo: \\n ".$Request['homedemo']."\\n";
$q10 = "callback: \\n ".$Request['callback']."\\n";

$message = $q1 . "\n" . $q2 . "\n" . $q3 . "\n" . $q4 . "\n" . $q5 . "\n" . $q6 . "\n" . $q7 . "\n" . $q8 . "\n" . $q9 . "\n" . $q10;

any more help please

thanks
keen to learn..

Turbonutter

5:12 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



I was going to say, those double backslashes look well dodgy to me. Use "\n" instead of "\\n". As for your blank data, var_dump($Request) to see what's in it.

Note: I wouldn't be surprised if you find you should be using $_REQUEST['email'] instead of $Request['email'], etc.

keentolearn

8:37 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



Hi

Thanks both for the help - im still struggling to get it to work as i hoped.

ive run out of time on this for now - but i will get back on later on the week and re-post to let you know if i sorted, in the meanwhile if you do have any other suggestions - please let me know

best wishes
Keen to learn..