title: How to fix "syntax error, unexpected end of file" error in PHP?
body: <p>I get this error and have tried all steps to eliminate it but can't, have also tried the steps demonstrated on stack overflow but to no avail:
  error:</p>
  
  <blockquote>
    <p>Parse error: syntax error, unexpected end of file in C:\wamp\www\project-Feedback form\project docs\login.php on line 80</p>
  </blockquote>
  
  <p>I have attached the entire snippet of code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  session_start(); // Starting Session
  $error=''; // Variable To Store Error Message
  ?&gt;
  
  &lt;html&gt;
   &lt;head&gt;
    &lt;title&gt;Login Page&lt;/title&gt;
    &lt;link rel="stylesheet" type="text/css" href="login.css"&gt; 
  
   &lt;/head&gt;
   &lt;body&gt;
    &lt;div id="header"&gt;
    &lt;center&gt;&lt;p&gt;&lt;img src="http://www.ruparel.edu/_/rsrc/1338008090424/config/customLogo.gif?revision=29" align="left" /&gt; &lt;img id="image" src="http://www.auplod.com/u/pudlao4d2f7.png"  /&gt; &lt;/p&gt;&lt;/center&gt;
    
    &lt;/div&gt;
    &lt;hr&gt;&lt;/hr&gt;
    &lt;center&gt;&lt;h1&gt; Welcome to the Login page for &lt;img src="http://www.auplod.com/u/uoalpd4d31a.png" /&gt; &lt;/h1&gt;&lt;/center&gt;
    &lt;center&gt;&lt;h2&gt;Please Login!&lt;/h2&gt;&lt;/center&gt;
   ` &lt;br /&gt;
    
    &lt;form method="post" action=" "&gt;
    &lt;div id="radio"&gt;&lt;b&gt;&lt;img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQMfjN-cd00MPhHqoKOKnUHp-VP3HSU3FBuuNDJbJL2yQF0fyWR"/&gt;Student&lt;input type="radio" name="radio1" value="Student"&gt;&lt;/p&gt;
    &lt;b&gt;&lt;img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSSnk6-xJ7aCZL8aODuWyRMAENzk7XIFitACfPJALdJOaTzQq1b-w" /&gt;Professor&lt;input type="radio" name="radio1" value="Professor"&gt;&lt;/b&gt; &lt;/div&gt;
    &lt;div id="fields"&gt;&lt;b&gt;ROll no:&lt;input type="text" name="username" &gt;&lt;/b&gt;
    &lt;b&gt;Password:&lt;input type="password" name="pwd"&gt;&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;input type="submit" name="submit" value="Login"&gt;&lt;/b&gt;&lt;/div&gt;
    
    &lt;/form&gt;
    
   &lt;?php
    if (isset($_POST['submit'])) 
    {
    if (empty($_POST['username']) || empty($_POST['password'])) 
    {
    $error = "Username or Password is invalid";
    }
    else
    {
     // Define $username and $password
    $username=$_POST['username'];
    $password=$_POST['password'];
    // Establishing Connection with Server by passing server_name, user_id and password as a parameter
    $connection = mysqli_connect("localhost", "root", "");
    // To protect MySQL injection for Security purpose
    $username = stripslashes($username);
    $password = stripslashes($password);
    $username = mysqli_real_escape_string($username);
    $password = mysqli_real_escape_string($password);
    // Selecting Database
    $db = mysqli_select_db($connection,"feedback data");
  
    // SQL query to fetch information of registerd users and finds user match.
    $query = mysqli_query($connection,"select * from login where password='$password' AND username='$username'");
    $rows = mysqli_num_rows($query);
    if ($rows == 1) {
    $_SESSION['login_user']=$username; // Initializing Session
    //now we write php code to decide if student or teacher
  
    $subject=$_SESSION['login_user'];
    $pattern="/[2$]/";
    if($_POST['radio1']=="Professor"&amp;&amp; preg_match($pattern,$subject)==1)//condition for teacher using BRE
    {
     header("location: http://localhost/project-Feedback%20form/project%20docs/selection_page_teacher.php");
    }
    elseif($_POST['radio1']=="Student"&amp;&amp; preg_match($pattern,$subject)==0)//condition for student using BRE
    {
     header("location: http://localhost/project-Feedback%20form/project%20docs/selection_page_student.php");
    }
    else
    {
     echo"The selection you have made is incorrect Mr.".$_SESSION['login_user'];
    }
    mysql_close($connection); // Closing Connection
    }
    }
    
   ?&gt;
   &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>