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']); ';

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...

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.

This article has been dead for over six months. Start a new discussion instead.