Chidori Soul Posted June 12, 2009 Share Posted June 12, 2009 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 --> Quote Link to comment Share on other sites More sharing options...
Axeia Posted June 12, 2009 Share Posted June 12, 2009 http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Ftparpg.awardspace.co.uk%2Fregister.php That's what's wrong with it. You're apparently closing a div and an anchor that never been opened Quote Link to comment Share on other sites More sharing options...
DarkSuperHero Posted June 12, 2009 Share Posted June 12, 2009 you need to rethinking your if statements one of hem is echoing false, and not echoing the top half of your source which includes your linkage to the css u specified. Quote Link to comment Share on other sites More sharing options...
Chidori Soul Posted June 12, 2009 Author Share Posted June 12, 2009 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 Quote Link to comment Share on other sites More sharing options...
dbrimlow Posted June 12, 2009 Share Posted June 12, 2009 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. Quote Link to comment Share on other sites More sharing options...
Axeia Posted June 12, 2009 Share Posted June 12, 2009 That if (isset($_POST['submit'])) { should be AFTER the <body> tag. As currently when the page is simply requested without submitting anything it will ommit the entire head section. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.