title: php script not working in Internet explorer and Firefox
body: <p>I have a button on a webpage that allows users to add a video on that page to their list of favourites. behind this button is a form and some php. The PHP code uses a session variable to retrieve the username. This information is used to get the relevant user id from the database and store its value in a variable. Using the input value from the form it was possible to retrieve the tuple from the videos database table that related to the video in question and store the values of the video title and URL attributes in variables. The code then checks if the user has already added the video as a “favourite”. The favourites database entity is checked for tuples containing both the user id and video id. If both are contained in a single row of the database table the user has already added the video and is notified of this. Otherwise, the user id, video id, video title and URL are inserted into the favourites database entity and the user is informed that the video has been added
  this all works fine in chrome or safari but does nothing in ie or firefox. The database is updated and message is displayed only in Chrome and safari. I've attached the code, please note the session has already been started in earlier code on the webpage. Any assistance would be greatly appreciated.</p>
  
  <pre><code>    &lt;div id="addfav"&gt;
      &lt;form action="python.php" method="post"&gt;
          &lt;input name="add" src="images/add.png" type="image"
          value="3"&gt;
      &lt;/form&gt;
      &lt;?php 
          $user=$_SESSION['user'];
  
          if ( isset( $_POST['add'] ) )
          {
              $vid = $_POST["add"];
              $sql = "SELECT * FROM `users` WHERE username = '$user'";
              $result = mysql_query($sql) or die(mysql_error());
              $row = mysql_fetch_array($result);
              $uid= $row['user_id'];
  
              $sql = "SELECT * FROM `Video` WHERE Video_id = '$vid'";
              $result = mysql_query($sql) or die(mysql_error());
              $row = mysql_fetch_array($result);
              $url=$row['URL'];
              $title=$row['Title'];
  
              $check = mysql_query("SELECT * FROM `favourites` WHERE Uid = '$uid' AND vid_id = '$vid'") or die (mysql_error());
              $r = mysql_num_rows($check);
  
              if ($r&gt;=1)
              {
                  echo "already added to favourites";
  
                  echo '&lt;script type="text/javascript"&gt;window.alert("Already added to favourites")&lt;/script&gt;';
                  //'&lt;span style="color: red;" /&gt;Already added to favourites &lt;/span&gt;' ;   
              }
  
              else 
              {  
                  mysql_query("INSERT INTO `favourites` (`Uid`,
                  `vid_id`,`url`,`title`) VALUES ('$uid',
                  '$vid','$url','$title')")or die(mysql_error());
                  echo "Added to favourites"; 
              }
          }
      ?&gt;
  &lt;/div&gt;
  </code></pre>