Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Odd HTML display with PHP commands

Status
Not open for further replies.

MDLU

IS-IT--Management
Nov 5, 2003
102
0
0
US
Start page: Error page: Username: test
Password: password

For some reason, when you successfully log in (using the info above), it moves the whole title bar to the right. You can then refresh the page (F5) and it'll print out correctly.

I can't figure out why it's doing this. It's gotta be something with the way my tables are set up, but who knows... anybody have any insight?



-Jay
 
Could you post some code for us please?

If it aint broke, redesign it!
 
Here's the code:

<body leftmargin="0" topmargin="0">
<table width="100%" height="100%" border="0" cellspacing="1" cellpadding="0">
<tr align="left" valign="top">
<td height="93" colspan="2">
<?php include("../topframe.htm"); ?>
</td>
</tr>
<tr>
<td width="180" align="left" valign="top">
<?php include("../leftframe.htm"); ?>
</td>
<td align="left" valign="top"> &nbsp;<table width="95%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="009999"><img src="/images/usertools.gif" width="165" height="48"></td>
</tr>
<tr>
<td height="3" valign="bottom" colspan="2"><img src="/images/hline.gif" width="100%" height="1"></td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp; </p>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?php
require_once('../includes/phpstd.php');

$username=$_POST['username'];
$password=$_POST['password'];

connectDB();

$query="SELECT * FROM clients where username = '$username'";
$result=mysql_query($query,$conn) or die(mysql_error());

$line = mysql_fetch_array($result);
//if valid user
if (($username==$line['username']) and ($password==$line['password'])) {
$name=$line['firstname'];
echo "<H1>Welcome, $name</h1>";
} else { ?>
<script language="JavaScript">
<!--
window.location="login.php?v2e=failed";
//-->
</script>
<?
}
mysql_close($conn);
?>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<p><br>
</p></td>
</tr>
<tr align="center" valign="top">
<td height="90" colspan="2"> <div align="center">
<?php include("../bottomframe.htm"); ?>
</div></td>
</tr>
</table>
</body>

-Jay
 

I have a site that has a similar problem, but it doesn't have anything to do with the PHP code, it's the html.

I can save the PHP generated HTML, put it up as a static page and my browser still renders it incorrectly about 30% of the time. The site was originally designed in dreamweaver and is heavy on tables, so I always blamed it on that.

FWIW, your checklogin page renders correctly in my browser.
 
I must admit I can't see anything. And it renders fine in firefox... its just IE.

Sorry I cudn't help

Westbury

If it aint broke, redesign it!
 
If the problem is just in IE you might want to try taking the line breaks out of the table areas in your code.
I sometimes get instances where these breaks in the code cause odd spaces to appear in tables in IE.

 
I figured out a creative solution to the problem! Meta Tags! Here's the code:

<?
if (!isset($_SESSION['refresh'])) {
echo "<meta http-equiv=\"refresh\" content=\"0\">";
$_SESSION['refresh']=1;
} else {
unset($_SESSION['refresh']);
}
?>

This just acts like I hit F5 and then stops. There's gotta be a better way, but hey, it works! :)

-Jay
 
Well done! I commend your lateral thinking! I must admit I wouldn't have thought of that. It may be a bit of a smoke and mirrors trick, but sometimes thats the only way!

Westbury

If it aint broke, redesign it!
 
Thanks, Westbury. Another update to this thread:

I wasn't satisfied with the refresh, just beacuse it's kinda annoying to see your screen flash on and off.

I changed the subtable to align itself completely to the left (not default) and then put a <p>&nbsp</p> at the end of it.

Here's the code snippet:

<td align="left" valign="top"><table width="95%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="009999"><img src="/images/titleimage.gif"></td>
</tr>
<tr>
<td height="3" valign="bottom" colspan="2"><img src="/images/hline.gif" width="100%" height="1"></td>
</tr>
</table><p>&nbsp;</p><p>&nbsp;</p>

-Jay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top