Hi, can anyone help me debug this piece of code please, any help will be much appreciated!

Its the body of a message im sending with mail() function..

Thanks,
Chris

Getting this error in FireBug..

Parse error: syntax error, unexpected '.' in /var/www/virtual/capetownalive.co.za/htdocs/bookings/scripts/xmlHttpRequest.php on line 28

$message = 'Cape Town Alive - Cape Xtreme Booking Request'
. 'Name:' . cleanPosUrl($_POST['posName']);
. 'Email:' . cleanPosUrl($_POST['posEmail']);
. 'Staying:' . cleanPosUrl($_POST['posStaying']);
. 'Country:' . cleanPosUrl($_POST['posCountry']);
. 'Contact:' . cleanPosUrl($_POST['posContact']);
. 'Actvity:' . cleanPosUrl($_POST['posActivity']);
. 'Comments:' . cleanPosUrl($_POST['posComments']); ';

Recommended Answers

All 4 Replies

I have put it in <> where the error is:
in the last line ' is not needed.check it.

$message = 'Cape Town Alive - Cape Xtreme Booking Request'
. 'Name:' . cleanPosUrl($_POST);
. 'Email:' . cleanPosUrl($_POST);
. 'Staying:' . cleanPosUrl($_POST);
. 'Country:' . cleanPosUrl($_POST);
. 'Contact:' . cleanPosUrl($_POST);
. 'Actvity:' . cleanPosUrl($_POST);
. 'Comments:' . cleanPosUrl($_POST); <'>;

Try it now...

Thanks for the quick response, getting this error now:

<b>Parse error</b>: syntax error, unexpected '.' in <b>/var/www/virtual/capetownalive.co.za/htdocs/bookings

/scripts/xmlHttpRequest.php</b> on line <b>33</b><br />

Changed it around a bit, rather look at this code:

$message = 'Cape Town Alive - Cape Xtreme Booking Request' <br> 'Name:' . cleanPosUrl($_POST['posName']); . 'Email:' . cleanPosUrl($_POST['posEmail']); . 'Staying:' . cleanPosUrl($_POST['posStaying']); . 'Country:' . cleanPosUrl($_POST['posCountry']); . 'Contact:' . cleanPosUrl($_POST['posContact']); . 'Actvity:' . cleanPosUrl($_POST['posActivity']); . 'Comments:' . cleanPosUrl($_POST['posComments']);

Try this.

$message = 
"Cape Town Alive - Cape Xtreme Booking Request <br> Name: ". cleanPosUrl($_POST['posName']) ."Email: ". cleanPosUrl($_POST['posEmail']) ."Staying: ". cleanPosUrl($_POST['posStaying']) ."Country:". cleanPosUrl($_POST['posCountry']) ."Contact: ". cleanPosUrl($_POST['posContact']) ."Actvity: ". cleanPosUrl($_POST['posActivity']) ."Comments: ". cleanPosUrl($_POST['posComments']);

Umm.. Why are you having ; at the end of every function call ? Moreover, <br> is a html tag and it should be in quotes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.