Page 1 of 1

Internet Explorer display problems

Posted: Thu Apr 29, 2010 3:14 pm
by tito85
Hi,

I am building a website and I am primery testing it in Firefox. However if I browse the site using Internet Explorer everything look and works fine exept of one page will I am attaching the code below.

The problem is it's look. The font is being displayed as bold and larger then is it suppost to be. All other pages are using the same format and css style and they are working and looking fine.

Any idea why I am having this problem?

Thanks!!!

Code: Select all

<?php
  require('dbconnect.php');
  session_start();
  if (isset($_POST['btnSubmitComment'])) {
      $body = mysql_real_escape_string($_POST['txtMessage']);
      if (strlen(trim($body)) > 0) {
          $query = "INSERT INTO comments (Comment, UserID, PostDateTime, MovieID) VALUES ('" . $body . "', '" . $_SESSION['userinfo']['id'] . "', '" . date("Y-m-d H:i:s") . "', '" . $_GET['id'] . "')";
          mysql_query($query);
      } else {
          $message = "Error: <b>Body</b> is mandatory";
      }
  }
  if (isset($_POST['btnSubmitRating'])) {
      $rating = $_POST['ddlRating'];
      if ($rating != "0") {
          $query = "INSERT INTO ratings (UserID, MovieID, Rating) VALUES ('" . $_SESSION['userinfo']['id'] . "', '" . $_GET['id'] . "', '" . $rating . "')";
          mysql_query($query);
      } else {
          $message2 = "Error: <b>Select Rating</b>";
      }
  }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Online Movie Database - Movie Details</title>
<link rel="stylesheet" href="CSSWebStyles/style.css" />
<link rel="shortcut icon" href="Images/filmicon.ico"/>
</head>
<body>
<div id="website">
<?php
//This will include the top banner of the WebSite
  include('banner.php');
?>
<?php
  //This will check if the user is an Administrator
  if (isset($_SESSION['superadmin'])) {
      if ($_SESSION['superadmin'])
          include('adminmenu.php');
  }
?>
<div id="content">
<div id="contentleft2">
<br />
<center>
<h2>Movie Details</h2>
</center>
<br />
<?php
  if (isset($_GET['id'])) {
      $select = "SELECT m.*, g.Genre AS genregenre FROM movies m INNER JOIN genres g ON g.GenreID = m.GenreID WHERE m.MovieID = '" . $_GET['id'] . "'";
      $result = mysql_query($select);
      if (mysql_num_rows($result) > 0) {
          while ($movies = mysql_fetch_array($result)) {
              echo "<div style=\"overflow: auto;\">";
              echo "<center><h3>" . stripslashes($movies['Title']) . "<h3></center>";
              echo "<br><br>";
              echo "<div style=\"float: right; padding-right: 150px; height: 400px; \">";
              if (strlen($movies['Filename']) > 0) {
                  echo "<img src=\"images/Movies/" . $movies['Filename'] . "\" />";
              }
              echo "</div>";
              echo "<div style=\"float: left; padding-left: 150px; padding-top: 50px; \">";
?>
<table>
<tr height="40px">
<td align="right">
<strong>Director/s: </strong>
</td>
<td>
<?php echo $movies['Director1']; ?>
</td>
<td>
<?php echo $movies['Director2']; ?>
</td>
</tr>
<tr height="40px">
<td align="right">
<strong>Genre: </strong>
</td>
<td>
<?php echo $movies['genregenre']; ?>
</td>
</tr>
<tr height="40px">
<td align="right">
<strong>Rating: </strong>
</td>
<td>
<?php
              if ($movies['Rating'] == 0)
                  echo "N/A";
              else
                  echo $movies['Rating'];
?>/10
</td>
</tr>
<tr height="40px">
<td align="right">
<strong>Movie Release Date: </strong>
</td>
<td>
<?php
              if (date("d/m/Y", strtotime($movies['MovieReleaseDate'])) == "01/01/1970")
                  echo "N/A";
              else
                  echo date("d/m/Y", strtotime($movies['MovieReleaseDate']));
?>
</td>
</tr>
<tr height="40px">
<td align="right">
<strong>DVD Release Date: </strong>
</td>
<td>
<?php
              if (date("d/m/Y", strtotime($movies['DVDReleaseDate'])) == "01/01/1970")
                  echo "N/A";
              else
                  echo date("d/m/Y", strtotime($movies['DVDReleaseDate']));
?>
</td>
</tr>
<?php
              if (isset($_SESSION['user']) && $_SESSION['user'] == true) {
?>
<tr height="40px">
<?php
                  $select = "SELECT * FROM favorites WHERE UserID = " . $_SESSION['userinfo']['id'] . " AND MovieID = " . $_GET['id'];
                  $isfavorite = mysql_query($select);
                  if (mysql_num_rows($isfavorite) == 0) {
?>
<td colspan="2" align='center'><a href="addtofavs.php?id=<?php echo $movies['MovieID'] ?>">Add to my Favorite Movies</a></td>
<?php
                  } else {
?>
<td colspan="2" align='center'><a href="removefromfavs.php?id=<?php echo $movies['MovieID'] ?>">Remove from my Favorites Movies</a></td>
<?php
                  }
?>
</tr>
<?php
              }
?>
</table>
<?php
              echo "</div>";
              //checking if current logged in user is an admin
              if (isset($_SESSION['user']) && $_SESSION['superadmin'] == true) {
                  echo "<div style=\"; clear: both;\"><a href=\"editmovie.php?id=" . $movies['MovieID'] . "\">Edit</a> | <a onclick=\"return confirm('Are you sure you want to delete this movie?');\" href=\"deletemovie.php?id=" . $movies['MovieID'] . "\">Delete</a></div>";
              }
              echo "</div>";
              echo "<br><br>";
              //Review
              echo "<div class=\"blog2\"><h4 style=\"margin: 0\">Movie Review</h4><p />";
              if (strlen($movies['Review']) > 0) {
                  echo nl2br($movies['Review']);
              } else {
                  echo "No review available yet";
              }
              echo "</div>";
              //Recommendations
              echo "<div class=\"blog2\"><h4 style=\"margin: 0\">We Recommend :</h4><p />";
              echo "<hr style=\"border: 1px solid #06C\" />";
              $query = "SELECT * FROM movies WHERE (Rating = " . $movies['Rating'] . " OR GenreID = " . $movies['GenreID'] . ") AND MovieID != " . $movies['MovieID'] . " AND Rating != 0 ORDER BY RAND() LIMIT 0,5";
              $recommendations = mysql_query($query);
              if (mysql_num_rows($recommendations) > 0) {
                  echo "<table align=\"center\"><tr>";
                  while ($recommendation = mysql_fetch_array($recommendations)) {
                      echo "<td><a href=\"moviedetails.php?id=" . $recommendation['MovieID'] . "\">" . '<img src="images/Movies/' . $recommendation['Filename'] . '" width="125" height="185" />' . "</a></td>";
                  }
                  echo "</tr></table>";
              }
              echo "</div>";
          }
          //Rating
          echo "<div class=\"blog2\"><h4 style=\"margin: 0\">Average User Rating</h4><hr style=\"border: 1px solid #06C\" />";
          $query = "SELECT SUM(Rating)/COUNT(0) AS averagerating FROM ratings r WHERE r.MovieID = '" . $_GET['id'] . "'";
          $averagerating = mysql_query($query);
          $query = "SELECT COUNT(0) AS ratingsgiven FROM Ratings r WHERE r.MovieID = '" . $_GET['id'] . "'";
          $count = mysql_query($query);
          echo "The average user rating of this movie is: <b>";
          if (mysql_result($averagerating, 0, 'averagerating')) {
              echo round(mysql_result($averagerating, 0, 'averagerating'), 1);
          } else
              echo "0";
          echo "/10</b><p />";
          echo "<b>" . mysql_result($count, 0, 'ratingsgiven') . "</b> user/s submitted their rating to this movie<hr style=\"border: 1px solid #06C\" />";
          //Checking if user submitted his rating already
          if (isset($_SESSION['user'])) {
              $query = "SELECT * FROM ratings WHERE UserID = '" . $_SESSION['userinfo']['id'] . "' AND MovieID = '" . $_GET['id'] . "'";
              $result = mysql_query($query);
              if (mysql_num_rows($result) > 0) {
                  echo "You already submitted your rating to this movie<p />";
                  echo "Your Rating is: <b>" . mysql_result($result, 0, 'Rating') . "/10</b>";
              } else {
                  echo "<p /><b>Submit your rating:</b>";
?>
<form method="post">
<?php
                  if (isset($message2)) {
                      echo "<center>$message2</center>";
                      unset($message2);
                  }
?>
<table>
<tr>
<td valign="top">
Rating:
</td>
<td>
<select name="ddlRating">
<option value="0">Please Select</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="submit" value="Submit" name="btnSubmitRating" />
</td>
</tr>
</table>
</form>
<?php
              }
          }
          echo "</div>";
          //Comments
          echo "<div class=\"blog2\"><h4 style=\"margin: 0\">User Comments</h4><hr style=\"border: 1px solid #06C\" />";
          $query = "SELECT c.*, u.Username, u.UserID AS userid FROM comments c INNER JOIN users u ON u.UserID = c.UserID WHERE c.MovieID = '" . $_GET['id'] . "' ORDER BY PostDateTime DESC";
          $result = mysql_query($query);
          while ($comment = mysql_fetch_array($result)) {
              echo "On " . date("d/m/Y", strtotime($comment['PostDateTime'])) . " <b><a href=\"user.php?id=" . $comment['userid'] . "\">" . $comment['Username'] . "</a></b> said:<br />";
              echo $comment['Comment'];
              echo "<hr style=\"border: 1px solid #06C\" />";
          }
          if (isset($_SESSION['user'])) {
              echo "<p /><b>Submit your comment:</b>";
?>
<form method="post">
<?php
              if (isset($message)) {
                  echo "<center>$message</center>";
                  unset($message);
              }
?>
<table>
<tr>
<td valign="top">
Message:
</td>
<td>
<textarea rows="5" cols="50" name="txtMessage"></textarea>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="submit" value="Submit" name="btnSubmitComment" />
</td>
</tr>
</table>
</form>
<?php
          }
          echo "</div>";
      } else {
          echo "<center><b>The movie you are trying to access does not exist</b></center>";
      }
  }
?>
</div>
</div>
<?php
  //will include the code from footer.php file 
  include('footer.php');
?>
</div>
</body>
</html>

Re: Internet Explorer display problems

Posted: Fri Apr 30, 2010 1:18 am
by cpetercarter
One possibility is that the html on the page does not validate. Unclosed <div> tags for instance often produce strange effects in the way the page is rendered. If your page is on the web, you could use the w3c validator to check.
Another possibility is that at some point, perhaps by accident, you enlarged the font size in IE for this page, and the browser has remembered what you want. In Firefox you enlarge the font size with Ctrl + and reduce it with Ctrl- - I am not sure whether it is the same in IE. Just try reducing the font size.

Re: Internet Explorer display problems

Posted: Fri Apr 30, 2010 7:35 am
by tito85
Tried to validate but still the same problem and this problem is happening on all pc's i'm testing on therefore its not due to text enlargment in internet explorer :(

Any other help please?

Re: Internet Explorer display problems

Posted: Fri Apr 30, 2010 8:23 am
by mikosiko
maybe because you are no closing the <h3> tag in this line

echo "<center><h3>" . stripslashes($movies['Title']) . "<h3></center>";

Re: Internet Explorer display problems

Posted: Fri Apr 30, 2010 9:36 am
by tito85
you are great man! Tnx for noting! I've tried checking this code many times and you spotted it on the first time!

Thanks a lot!!!!