Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    unexpected T_VARIABLE - Again!?!?

    hey,

    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.

    PHP Code:
    <?php

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

    // subject
    $subject "Birthday";

    // message
    $message '
    <html>
    <head>
      <title>Birthday Reminders for August</title>
    </head>
    <body>
      <p>Here are the birthdays upcoming in August!</p>
      <table>
       <tr>
         <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
       </tr>
       <tr>
         <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
       </tr>
       <tr>
         <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
       </tr>
      </table>
    </body>
    </html>
    '
    ;

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

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    You need a colon after
    PHP Code:
    $to  'f9096752@bournemouth.ac.uk' 

  • #3
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    cheers muchly.

    Gave you + on you rep.

  • #4
    New Coder
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    91
    Thanks
    21
    Thanked 0 Times in 0 Posts
    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.
    Thank you for your time to read my post

  • #5
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •