Jump to content

PHP Cancelling out CSS


Chidori Soul

Recommended Posts

Ok, so my register Page works fine, but the only problem is that if I remove the PHP off of the page, it turns normal, but if I put the PHP on it, it messes up the stylesheet.

 

My Register Page

 

Easier, my code:

<?php
// Connects to your Database
mysql_connect("fdb1.awardspace.com", "chidorisoul_sh", "******") or die(mysql_error());
mysql_select_db("chidorisoul_sh") or die(mysql_error());

//This code runs if the form has been submitted
if (isset($_POST['submit'])) {

//This makes sure they did not leave any fields blank
if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) {
die('You did not complete all of the required fields');
}

// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST['username'] = addslashes($_POST['username']);
}
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);

//if the name exists it gives an error
if ($check2 != 0) {
die('Sorry, the username '.$_POST['username'].' is already in use.');
}

// this makes sure both passwords entered match
if ($_POST['pass'] != $_POST['pass2']) {
die('Your passwords did not match. ');
}

// here we encrypt the password and add slashes if needed
$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);
}

// now we insert it into the database
$insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['username']."', '".$_POST['pass']."')";
$add_member = mysql_query($insert);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Register</title>
<style type="text/css">
<!--
body,td,th {
color: #FF0000;
font-family: Tahoma;
font-size: 9px;
font-weight: bold;
}
body {
background-color: #000000;
}
.thead {
background: #302226;
border: 1px solid #000000;
border-bottom: 0px;
text-align: center;
vertical-align: middle;
height: 15px;
}
.tnav {
background: #302226;
border: 1px solid #000000;
border-bottom: 0px;
text-align: center;
height: 15px;
}
.tnav2 {
background: #302226;
border: 1px solid #000000;
border-bottom: 1px solid black;
text-align: center;
height: 15px;
}
.news {
background: #302226;
border: 1px solid #000000;
border-bottom: 1px solid #000000;
text-align: center;
height: 15px;
}
.banner {
border-bottom: 0px;
}
.dis {
border-top: 0px;
}
.con {
border-top: 0px;
border-bottom: 0px;
}
.party {
background: #302226;
border: 1px solid #000000;
border-bottom: 0px;
text-align: center;
height: 25px;
}
a:link {
color: #990000;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #990000;

}
a:active {
text-decoration: none;
color: #FFFFFF;
}
.style1 {color: #FFFFFF}
-->
</style>
<body>
<table align="center" width="200" height="247" border="0" cellpadding="0" cellspacing="0" bordercolor="#FF0000">
<tr>
<td align="left" valign="top"><table width="802" height="120" border="1" cellpadding="0" cellspacing="0" bordercolor="#FF0000" class="banner">
<tr>

<th background="http://i286.photobucket.com/albums/ll84/ChidoriSoul/BetterAsteroidBanner.png?t=1243111409" scope="col"> </th>
</tr>
</table>
<table width="802" height="120" border="1" cellpadding="0" cellspacing="0" bordercolor="#FF0000" class="con">
<tr>

<!--- Ads -->
<div style="text-align: center"><script type="text/javascript"><!--
google_ad_client = "pub-4468899317544238";
/* TPARPG */
google_ad_slot = "0388012058";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>

<!--- End of Ads -->

<!--- Left Nav -->
<th width="122" align="center" valign="top" bgcolor="#302226" scope="row">
<div class="thead style1" id="thead"> <font color='limegreen'>General Options</font> </div>

<div class="tnav"> <a href="http://tparpg.awardspace.co.uk/home.php"><font color='blue'>Home</font></a></div>
<div class="tnav"> <a href="http://tparpg.awardspace.co.uk/register.php"><font color='blue'><del>Register</del></font></a></div>
<div class="tnav"> <a href="http://tparpg.awardspace.co.uk/login.php"><font color='blue'><del>Login</del></font></a></div>

<div class="thead style1" id="thead"> <font color='limegreen'>Miscellaneous</font> </div>
<div class="tnav"> <a href="http://tparpg.awardspace.co.uk/about.php"><font color='blue'>About TPA</font></a></div>
<div class="tnav"> <a href="http://tparpg.awardspace.co.uk/storyline.php"><font color='blue'>Storyline</font></a></div>
<div class="tnav"> <a href="http://tparpg.awardspace.co.uk/chatbox.php"><font color='blue'>Chatbox</font></a></div>
<div class="tnav"> <a href="http://www.punbb-hosting.com/forums/TPA_Forums/index.php"><font color='blue'>Forum</font></a></div>

<div class="thead style1" id="thead"> <font color='limegreen'>Statistics</font> </div>
<div class="tnav"> <font color='blue'>Total Users: 0</font></div>
</th>

<!--- End Of Left Nav -->
<!--- Start Content -->

<th width="520" align="center" valign="top" bgcolor="#302226" scope="row">
<div class="news" id="thead"> Index </div>
<br />

<?php
}
else
{
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table border="0">
<tr><td>Username:</td><td>
<input type="text" name="username" maxlength="60">
</td></tr>
<tr><td>Password:</td><td>
<input type="password" name="pass" maxlength="10">
</td></tr>
<tr><td>Confirm Password:</td><td>
<input type="password" name="pass2" maxlength="10">
</td></tr>
<tr><th colspan=2><input type="submit" name="submit" value="Register"></th></tr> </table>
</form>
<?php
}
?>
<!--- End Content -->
<!--- Right Nav -->
<th width="122" align="center" valign="top" bgcolor="#302226" scope="row">
<div class="thead style1" id="thead"> <font color='limegreen'>General Options</font> </div>

<div class="tnav"> <a href="http://tparpg.awardspace.co.uk/home.php"><font color='blue'>Home</font></a></div>
<div class="tnav"> <a href="http://tparpg.awardspace.co.uk/register.php"><font color='blue'><del>Register</del></font></a></div>
<div class="tnav"> <a href="http://tparpg.awardspace.co.uk/login.php"><font color='blue'><del>Login</del></font></a></div>

<div class="thead style1" id="thead"> <font color='limegreen'>Miscellaneous</font> </div>
<div class="tnav"> <a href="http://tparpg.awardspace.co.uk/about.php"><font color='blue'>About TPA</font></a></div>
<div class="tnav"> <a href="http://tparpg.awardspace.co.uk/storyline.php"><font color='blue'>Storyline</font></a></div>
<div class="tnav"> <a href="http://tparpg.awardspace.co.uk/chatbox.php"><font color='blue'>Chatbox</font></a></div>
<div class="tnav"> <a href="http://www.punbb-hosting.com/forums/TPA_Forums/index.php"><font color='blue'>Forum</font></a></div>

<div class="thead style1" id="thead"> <font color='limegreen'>Statistics</font> </div>
<div class="tnav"> <font color='blue'>Total Users: 0</font></div>
</th>


<!--- End Of Right Nav -->

<!--- Disclaimer -->
<table width="765" height="45" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FF0000" "backgroundcolor="#302226" class="dis">
<tr>
<td align="center" valign="top"><strong>Disclaimer</strong><br />

The Pokémon Asteroid RPG is © owned and coded by Shadow.
All sprites are Copyrighted 2009 Pokémon © Nintendo, Game Freak, Creatures Ink all rights reserved.
The Asteroid RPG is not affiliated with the organizations listed above or any
other organizations that have co-operated or are co-operating in the programming or making of Pokémon.
The images are copyright of their respective owners. This RPG is best viewed with Firefox. </td>
</tr>


</table></a></div>
<!--- End of Disclaimer -->

Link to comment
Share on other sites

Axeia: I did look through that and the Source Code, and I did not find those errors in my original code.

 

DarKsuperHero: I know, someone says that it is based on this statement:

 

if (isset($_POST['submit'])) {

 

but, I can not find where I would replace it for the CSS to come back and work

Link to comment
Share on other sites

Your page is not an html document! No Doctype, no html tag, no heag tag (which is where your css link is), no body tags no closing body or closing html tags.

 

That page is just a form and table naked and alone. 

 

A proper html structured document would be similar to this:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Whatever</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/whatever.css">
</head>
<body>
your forms and tables and other content
</body>
</html>

 

That's what darksuperhero is trying to tell you.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.