php css not working?

OK i have all my php code working for my log in n the like yey! :O

but am trying to allso have div tags and text with css styling on the same page as my php log in code. the css is not working when i load the page up untill i log in. how can i get the css to work?
<?php
session_start();

if(isset($_POST['submit1'])) {
logout();
}

if(isset($_POST['submit'])) {
login();
}






function login()
{
		//get form data
$username = $_POST['username'];
$password = $_POST['password'];
if ($username&&$password)
{
	include("conf.php");

	
	$connection = mysql_connect($databaseURL,$databaseUName,$databasePWord) or die ("Error while connecting to localhost");
    $db = mysql_select_db($databaseName,$connection) or die ("Error while connecting to database");

$query = mysql_query("SELECT * FROM members WHERE username='$username'");
					 
$numrows = mysql_num_rows ($query);

if ($numrows!=0)

{
	
	while ($row = mysql_fetch_assoc($query))
	{
	$dbusername = $row['username'];
	$dbpassword = $row['password'];
	
	}
	// check to see if they are matching !? :)
	if ($username==$dbusername&&$password==$dbpassword)
	{
		
	
	$_SESSION['username']=$username;
	if ($_SESSION['username'])
echo "Welcome, ".$_SESSION['username'];
	
	
	}
	else
	echo "password incorrect!";
}


else
echo("That user name does not exist!");


	
}
else
echo("please enter a username and password!");

}

function logout()
{
session_destroy();
if ($_SESSION=='username'){
echo "fail";}
else{
        echo "You've been logged out.";
}

}


?>



<!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>Untitled Document</title>

<style type="text/css">
<!--
#1 {
	position: absolute;
	left: 123px;
	top: 233px;
}
#2 {
	position: absolute;
	left: 502px;
	top: 15px;
	height: 28px;
}
#3 {
	position: absolute;
	left: 569px;
	top: 15px;
}
-->
</style>

</head>
<body>



<div id="1">
<form action="<?=$_SERVER['PHP_SELF'];?>" method="POST">
Username:<input type='text' name='username'>
Password:
<input type='password' name='password'>
<input type="submit" name="submit" value="Submit">
</form>
</div>

<div id="2">

<form action="<?=$_SERVER['PHP_SELF'];?>" method="POST">
<input type="submit" name="submit1" value="Log out">
</form>
</div>

<div id="3">

<form action="mysql_insert.html" method="get">
  <input type="submit" name="submit2" value="Need to Register?" />
</form>
</div>
</body>
</html>

Open in new window

LVL 1
helpchrisplzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

john-formbyCommented:
Hi,

CSS will not allow you to name styles beginning with a number.  Change your code to the following and it will work.

Hope this helps,

John
<?php 
session_start(); 
 
if(isset($_POST['submit1'])) { 
logout(); 
} 
 
if(isset($_POST['submit'])) { 
login(); 
} 
 
 
 
 
 
 
function login() 
{ 
                //get form data 
$username = $_POST['username']; 
$password = $_POST['password']; 
if ($username&&$password) 
{ 
        include("conf.php"); 
 
         
        $connection = mysql_connect($databaseURL,$databaseUName,$databasePWord) or die ("Error while connecting to localhost"); 
    $db = mysql_select_db($databaseName,$connection) or die ("Error while connecting to database"); 
 
$query = mysql_query("SELECT * FROM members WHERE username='$username'"); 
                                          
$numrows = mysql_num_rows ($query); 
 
if ($numrows!=0) 
 
{ 
         
        while ($row = mysql_fetch_assoc($query)) 
        { 
        $dbusername = $row['username']; 
        $dbpassword = $row['password']; 
         
        } 
        // check to see if they are matching !? :) 
        if ($username==$dbusername&&$password==$dbpassword) 
        { 
                 
         
        $_SESSION['username']=$username; 
        if ($_SESSION['username']) 
echo "Welcome, ".$_SESSION['username']; 
         
         
        } 
        else 
        echo "password incorrect!"; 
} 
 
 
else 
echo("That user name does not exist!"); 
 
 
         
} 
else 
echo("please enter a username and password!"); 
 
} 
 
function logout() 
{ 
session_destroy(); 
if ($_SESSION=='username'){ 
echo "fail";} 
else{ 
        echo "You've been logged out."; 
} 
 
} 
 
 
?> 
 
 
 
<!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>Untitled Document</title> 
 
<style type="text/css"> 
<!-- 
#one { 
        position: absolute; 
        left: 123px; 
        top: 233px; 
} 
#two { 
        position: absolute; 
        left: 502px; 
        top: 15px; 
        height: 28px; 
} 
#three { 
        position: absolute; 
        left: 569px; 
        top: 15px; 
} 
--> 
</style> 
 
</head> 
<body> 
 
 
 
<div id="one"> 
<form action="<?=$_SERVER['PHP_SELF'];?>" method="POST"> 
Username:<input type='text' name='username'> 
Password: 
<input type='password' name='password'> 
<input type="submit" name="submit" value="Submit"> 
</form> 
</div> 
 
<div id="two"> 
 
<form action="<?=$_SERVER['PHP_SELF'];?>" method="POST"> 
<input type="submit" name="submit1" value="Log out"> 
</form> 
</div> 
 
<div id="three"> 
 
<form action="mysql_insert.html" method="get"> 
  <input type="submit" name="submit2" value="Need to Register?" /> 
</form> 
</div> 
</body> 
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
helpchrisplzAuthor Commented:
lol this was so simple silly me :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.