View Full Version : unexpected T_VARIABLE - Again!?!?

03-14-2007, 09:18 PM

This is my first post here and I can see me being around alot so I would like to say hi...

anyway, for the problem.

I have the following code on a page which should e-mail to my university e-mail account. The code is taken from the uk2.php.net website so im not sure why it dont wanna play.


// multiple recipients
$to = 'f9096752@bournemouth.ac.uk'

// subject
$subject = "Birthday";

// message
$message = '
<title>Birthday Reminders for August</title>
<p>Here are the birthdays upcoming in August!</p>

// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);

the error i get is

Parse error: parse error, unexpected T_VARIABLE in /home/f9070792/www/email_test/email.php on line 7

I have worked with php for a bit and can't for the life of me work out what the problem on line 7 is...

03-14-2007, 09:24 PM
You need a colon after
$to = 'f9096752@bournemouth.ac.uk'

03-14-2007, 09:41 PM
cheers muchly.

Gave you + on you rep.

03-14-2007, 10:45 PM
Would just like to add that, you can see the actual problem isn't at line 7, but on line 4. I'm sure you've noticed this yourself, still would like to point it out.

I've had this problem a lot myself so I know how to solve PHP errors by now, or at least, where I should look for them after I got the error message.

03-14-2007, 10:57 PM
I think it reports it at line 7 as i cannot create a variable inside the creation of another...

but yeah...ive noticed these before but i couldnt see this one for anything...

aah well...lesson learned