Need help from the PHP GURU's

From: Greg (greg_at_aperfectnumber.com)
Date: 03/26/05


Date: Sat, 26 Mar 2005 14:37:19 -0800

Ok, simple Mass Mailing Script I'm working on. Sessions are involved to protect the page. The code is below. When I try and access the page I'm getting the IE error: Parse error: parse error, unexpected $ in /home/gregerl/public_html/users/mailsend.php on line 49. Line 49 is the last line with the ?> . I've been thru the code numerous times but can't find the unexpected $var? Any ideas?

CODE:

<?

session_start();

 if (!isset($_SESSION['fname']))
      {
           header ("Location: someserver.com");
      }
 else
 
 if (isset($_SESSION['fname']))
      {
           $subject = $_POST['subject'];
           $message = $_POST['message'];
           $headers = "From: somebody <someone@somebody.net>";
           $self = $_SERVER['PHP_SELF'];
   
           if ( !isset($subject) or !isset($message) )
                { ?>
    
                    <h1>Send a mass email</h1>
                    <form action="<? echo ("$self"); ?>" method="post">
                    Subject: <input type="text" name="subject" /><br />
                    Message: <textarea name="message"></textarea>
                    </form>
    
                <? }
    
    else
    
    if( isset($subject) && isset($message) )
         {
              require ("../dbconnect.php");
      
              $sql = "SELECT * FROM users";
              $results = @mysql_query($sql);
      
              while ($row = @mysql_fetch_array($results))
                   {
                        $email = $row['email'];
                        $fname = $row['fname'];
                        $lname = $row['lname'];
        
                        mail($email, $subject, $message, $headers);
                        echo("Mail Sent To: $fname $lname at email address: $email");
        
                   }
         }
    ?>