PDA

View Full Version : Problems with IE



Torrent of Flame
06-23-2009, 10:26 PM
My code is working perfectly fine in FF, but when I try it in Internet Explorer 7 it is not working. My website is www.definition-designs.co.uk

I have checked with W3C my code on the Index page and the CSS page, index page getting XHTML 1.1 and CSS validating at CSS 2.1.

On the Index page on FF, the padding works at the bottom and top on the navbar, but in IE7 it only pads the top and not the bottom. My index.html code is;


<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Definition Designs - Web and Graphics Design</title>
<meta name="Author" content="Joshua Martin" />
<meta name="Description" content="Definition Designs is the website of Web and Graphic Designer Joshua Martin" />
<link href="/stylesheet.css" rel="stylesheet" type="text/css"/>
</head>

<body>
<div id="header">
<div id="header-text">
definition<div id="z">designs</div>
</div>
</div>

<div id="navbar">
<ul>
<li><a href="/index.html">home</a></li>
<li><a href="#">about</a></li>
<li><a href="#">portfolio</a></li>
<li><a href="#">blog</a></li>
<li><a href="#">tutorials</a></li>
<li><a href="/contact.php">contact</a></li>
</ul>
</div>

<div id="mainContent">
<p>Lorem ipsum boring gypsum.</p>
</div>

</body>
</html>

On my contact.php page, it works fine in FF again, but in IE7 the div is pushed to the left and does not center. Also, the navbar becomes distorted in IE. My contact.php page code is this, and as far as I know, this isnt a PhP error, this is a problem with my divs. (I am not very good at PhP, but it works fine for me);


<?php

$recipient = 'defenitiondesigns@googlemail.com';
$serverName = 'www.definition-designs.co.uk';


if ($_POST['send']) {
sendMail();
} elseif (($_POST['cancel']) || ($_POST['continue'])) {
redirect();
} else {
displayForm();
}

function displayForm($messages = array())
{
global $login;
$escapedEmail = htmlspecialchars($_POST['email']);
$escapedRealName = htmlspecialchars($_POST['realname']);
$escapedSubject = htmlspecialchars($_POST['subject']);
$escapedBody = htmlspecialchars($_POST['body']);
$returnUrl = $_POST['returnurl'];
if (!strlen($returnUrl)) {
$returnUrl = $_SERVER['HTTP_REFERER'];
if (!strlen($returnUrl)) {
$returnUrl = '/';
}
}
$escapedReturnUrl = htmlspecialchars($returnUrl);
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Definition Designs - Web and Graphics Design</title>
<meta name="Author" content="Joshua Martin" />
<meta name="Description" content="Definition Designs is the website of Web and Graphic Designer Joshua Martin" />
<link href="/stylesheet.css" rel="stylesheet" type="text/css"/>
</head>

<body>
<div id="header">
<div id="header-text">
definition<div id="z">designs</div>
</div>
</div>

<div id="navbar">
<ul>
<li><a href="/index.html">home</a></li>
<li><a href="#">about</a></li>
<li><a href="#">portfolio</a></li>
<li><a href="#">blog</a></li>
<li><a href="#">tutorials</a></li>
<li><a href="/contact.php">contact</a></li>
</ul>
</div>

<div id="contactForm">
<?php
if (count($messages) > 0) {
$message = implode("<br>\n", $messages);
echo("<h4>$message</h4>\n");
}
?>

<form method="POST" action="<?php echo $_SERVER['DOCUMENT_URL']?>">
<p>
<b>Your</b> Email Address
<input
name="email"
size="35"
maxlength="35"
value="<?php echo $escapedEmail?>"/>
</p>
<p>
Your <b>Real</b> Name
<input
name="realname"
size="35"
maxlength="35"
value="<?php echo $escapedRealName?>"/>

</p>
<p>
Subject Of Your Message
<input
name="subject"
size="35"
maxlength="35"
value="<?php echo $escapedSubject?>"/>

</p>
<p>
<i>Please enter the text of your message in the field that follows.</i>
</p>
<textarea
name="body"
rows="10"
cols="60"><?php echo $escapedBody?></textarea>
<p>
<input type="submit" name="send" value="Send Your Message"/>
<input type="submit" name="cancel" value="Cancel - Never Mind"/>
</p>
<input
type="hidden"
name="returnurl"
value="<?php echo $escapedReturnUrl?>"/>
</form>

<?php
}

function redirect()
{
global $serverName;
$returnUrl = $_POST['returnurl'];
$prefix = "http://$serverName/";
if (!beginsWith($returnUrl, $prefix)) {
$returnUrl = "http://$serverName/";
}
header("Location: $returnUrl");
}

function beginsWith($s, $prefix)
{
return (substr($s, 0, strlen($prefix)) === $prefix);
}

function sendMail()
{
global $recipient;

$email = $_POST['email'];
if (!preg_match("/^[\w\+\-\.\~]+\@[\-\w\.\!]+$/", $email)) {
$messages[] = "That is not a valid email address. In format: You@something.com";
}
$realName = $_POST['realname'];
if (!preg_match("/^[\w\ \+\-\'\"]+$/", $realName)) {
$messages[] = "<br>The real name field must contain only alphanumeric characters, spaces and + or - signs.";
}
$subject = $_POST['subject'];
if (preg_match('/^\s*$/', $subject)) {
$messages[] = "<br>Please specify a subject for your message.


";
}
$body = $_POST['body'];
if (preg_match('/^\s*$/', $body)) {
$messages[] = "<br>Your message was blank. Fill out a message or Click Cancel to cancel message.<br><br>";
}
if (count($messages)) {
displayForm($messages);
return;
}

mail($recipient,
$subject,
"

From: $realName, $email;

------------------------------------------

$body") or die("Unable to send the mail!");

$escapedReturnUrl = htmlspecialchars($_POST['returnurl']);
?>
</div>
<?php
}
?>
</body>
</html>


This is my stylesheet code;


body,td,th {
font-family: Arial, Helvetica, sans-serif;
background-color: #e5e5e5;
color: #000;
text-align: left;
margin: 0;
padding: 0;
}
p {
padding: 0 0 12.5px 0;
}
#z {
color: #999;
display: inline;
font-weight: bold;
}
#header{
background-image: url(/PNGs/backgroundheader.png);
height: 40px;
float: left;
width: 100%;
padding: 40px 0;
text-align: left;
display: inline;
font-size: 25px;
font-family: Tahoma, Geneva, sans-serif;
color: #FFFFFF;
position: absolute;
}
#header-text {
padding-left: 140px;
}
#navbar ul{
background-color: #2a2a2a;
background-image: url(/PNGs/repeating.png);
border-top: 1px solid #FFFFFF;
font-size: 14px;
margin: 0;
top: 80px;
height: 30px;
position: relative;
padding: 15px 0 0 120px;
}
#navbar ul li {
display: inline;
height: 20px;
}
#navbar ul li a {
text-decoration: none;
width: 100px;
color: #FFFFFF;
padding: 5px 20px 5px 20px;
}
#navbar ul li a:hover {
color: #FFF;
background: url(PNGs/gradientbkg.png) 0% 0% repeat;
border-top: 1px solid #434343;
border-bottom: 1px solid #434343;
}
#mainContent {
text-align: center;
top: 80px;
width: 77%;
margin-left: auto;
margin-right: auto;
position: relative;
padding-bottom: 20px;
padding-top: 20px;
padding-left: 15px;
background-color: #FFFFFF;
border-left: 2px solid #FFC;
border-right: 2px solid #FFC;
}
#contactForm {
top: 80px;
width: 77%;
margin-left: auto;
margin-right: auto;
position: relative;
padding-bottom: 20px;
padding-top: 20px;
padding-left: 15px;
background-color: #FFFFFF;
border-left: 2px solid #FFC;
border-right: 2px solid #FFC;
text-align: left;
font-size: 12px;
}
#mainContent q {
text-align: center;
}


If anyone could tell me how to fix this cross-browser error this would be much appreciated!

ShowerThoughts
06-23-2009, 10:28 PM
Make it detect if someone uses internet explorer then send it to an .asp(x) site which takes control of their pc and installs FF.

That will get the job done.

Torrent of Flame
06-23-2009, 10:29 PM
Haha. I wish everyone was on FF, but alas, no.

ShowerThoughts
06-23-2009, 10:31 PM
Haha. I wish everyone was on FF, but alas, no.

Why not? If microsoft is allowed to (do that), then you're too!
Sounds fair to me.

Wizzup?
06-24-2009, 12:12 AM
A website should always work, regardless of the browser. :)

Torrent of Flame
06-24-2009, 12:17 AM
A website should always work, regardless of the browser. :)

I know, see Hermen!

AND DAMN YOU WIZZUP. I got my hopes up cause you replied and your a 1337 coder so I thought you had fixed it :(

ShowerThoughts
06-24-2009, 12:42 AM
I know, see Hermen!

AND DAMN YOU WIZZUP. I got my hopes up cause you replied and your a 1337 coder so I thought you had fixed it :(

What is the problem?
The problem IS fixed.
It doesn't works on IE so what?
95% of the active members here uses something else then IE.
I know you're not only coding for these people, but what the heck.

Torrent of Flame
06-24-2009, 12:44 AM
What is the problem?
The problem IS fixed.
It doesn't works on IE so what?
95% of the active members here uses something else then IE.
I know you're not only coding for these people, but what the heck.

http://www.w3schools.com/browsers/browsers_stats.asp
http://www.w3schools.com/browsers/browsers_explorer.asp

HAS to encorperate those 40% on IE still.

XabdullahX
06-24-2009, 12:53 AM
U fixed it ? i cant seem to find any differences in both browsers?

Torrent of Flame
06-24-2009, 01:03 AM
No I havent fixed it.. 0_o

XabdullahX
06-24-2009, 04:09 AM
try ie 8 it might work there ?

senrath
06-24-2009, 04:38 AM
try ie 8 it might work there ?

The main page works properly in IE 8, but the contact page still messes up.

XabdullahX
06-24-2009, 06:11 AM
Could you put the website in rar file. Too lazy to do it myself :p
I will look at it

caused
06-24-2009, 06:43 AM
There you go..

style.css


body,td,th {
font-family: Arial, Helvetica, sans-serif;
background-color: #e5e5e5;
color: #000;
text-align: left;
margin: 0;
padding: 0;
}
p {
padding: 0 0 12.5px 0;
}
#z {
color: #999;
display: inline;
font-weight: bold;
}
#header{
background-image: url(/PNGs/backgroundheader.png);
height: 40px;
float: left;
width: 100%;
padding: 40px 0;
text-align: left;
display: inline;
font-size: 25px;
font-family: Tahoma, Geneva, sans-serif;
color: #FFFFFF;
position: absolute;
}
#header-text {
padding-left: 140px;
}
#navbar ul{
background-color: #2a2a2a;
background-image: url(/PNGs/repeating.png);
font-size: 14px;
margin: 0;
top: 80px;
height: 30px;
position: relative;
padding-top: 15px;
padding-bottom: 10px;
}

#navbar li {
display: inline;
height: 20px;ยด
padding-top: 15px;
padding-bottom: 10px;
}


#navbar a {
text-decoration: none;
width: 100px;
color: #FFFFFF;
margin-left:32px;
}

#navbar ul li a:hover {
color: #FFF;
background: url(PNGs/gradientbkg.png) 0% 0% repeat;
border-top: 1px solid #434343;
border-bottom: 1px solid #434343;
}



#mainContent {
text-align: center;
top: 80px;
width: 77%;
margin-left: auto;
margin-right: auto;
position: relative;
padding-bottom: 20px;
padding-top: 20px;
padding-left: 15px;
background-color: #FFFFFF;
border-left: 2px solid #FFC;
border-right: 2px solid #FFC;
}

#main {
text-align: center;
}

#contactForm {
top: 80px;
width: 77%;
margin-left: auto;
margin-right: auto;
position: relative;
padding-bottom: 20px;
padding-top: 20px;
padding-left: 15px;
background-color: #FFFFFF;
border-left: 2px solid #FFC;
border-right: 2px solid #FFC;
text-align: left;
font-size: 12px;
}
#mainContent q {
text-align: center;
}


and the index O_O.

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Definition Designs - Web and Graphics Design</title>
<meta name="Author" content="Joshua Martin" />
<meta name="Description" content="Definition Designs is the website of Web and Graphic Designer Joshua Martin" />
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>

<body>
<div id="main">

<div id="header">
<div id="header-text">
definition<div id="z">designs</div>
</div>
</div>

<div id="navbar">
<ul>
<li><a href="/index.html">home</a></li>
<li><a href="#">about</a></li>
<li><a href="#">portfolio</a></li>
<li><a href="#">blog</a></li>
<li><a href="#">tutorials</a></li>
<li><a href="/contact.php">contact</a></li>
</ul>
</div>

<div id="mainContent">
<p>Lorem ipsum boring gypsum.</p>
</div>
</div>
</body>
</html>


Edit: Oh.. its kinda messy now :X .. uhm I'll fix everything tommorow. Need some sleep now XD
Basicly For IE you need to define every padding for every element, but not always *_*... It's a weird thing, you get used to it, once youve done some sites ; D

NiCbaZ
06-24-2009, 03:14 PM
Make a style sheet that works for each browsers ( they will have to be different ) and just use the If IE[7] etc, to attach them.

Torrent of Flame
07-02-2009, 09:50 PM
I've fixed now, didnt need a new stylesheet, either ^_^