Hi I am starting to build a web site for my personal use. I used a template from dreamweaver, and so far it is going great. However when I tried to add a registration page (using PHP) some of the rollover menus have stopped working. If I remove the PHP they begin working again! You can see what I'm talking about by going to: victorb17.com then clicking on login at the top. Notice how the top menu shows a sub menu when you rollover certain links. this is what is being 'damaged' by the PHP. after you click login click on register and enter a user name and password and click submit. The page you will be brought to is a PHP page and notice the menu at the top no longer works. also if you look in the status bar (of internet explorer) you will see an alert which you can click on to find out why it has caused an error. I tried to figure it out but can't. Thanks for any help! Here is the faulty page's full code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- DW6 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>:: Welcome to Victorb17.com ::</title>
<link rel="stylesheet" href="emx_nav_left.css" type="text/css">
<script type="text/javascript">
<!--
var time = 3000;
var numofitems = 7;
//menu constructor
function menu(allitems,thisitem,startstate){
callname= "gl"+thisitem;
divname="subglobal"+thisitem;
this.numberofmenuitems = 7;
this.caller = document.getElementById(callname);
this.thediv = document.getElementById(divname);
this.thediv.style.visibility = startstate;
}
//menu methods
function ehandler(event,theobj){
for (var i=1; i<= theobj.numberofmenuitems; i++){
var shutdiv =eval( "menuitem"+i+".thediv");
shutdiv.style.visibility="hidden";
}
theobj.thediv.style.visibility="visible";
}
function closesubnav(event){
if ((event.clientY <48)||(event.clientY > 107)){
for (var i=1; i<= numofitems; i++){
var shutdiv =eval('menuitem'+i+'.thediv');
shutdiv.style.visibility='hidden';
}
}
}
// -->
</script>
<style type="text/css">
<!--
.style1 {font-size: 150%}
-->
</style>
</head>
<body onmousemove="closesubnav(event);">
<div class="skipLinks">skip to: <a href="#content">page content</a> | <a href="pageNav">links on this page</a> | <a href="#globalNav">site navigation</a> | <a href="#siteInfo">footer (site information)</a> </div>
<div id="masthead">
<h1 id="siteName">Welcome to Victorb17.com </h1>
<div id="utility">
<a href="#">Contact Info </a> | <a href="#">My Account </a>| <a href="#">Help</a>
</div>
<div id="globalNav">
<img alt="" src="gblnav_left.gif" height="32" width="4" id="gnl"> <img alt="" src="glbnav_right.gif" height="32" width="4" id="gnr">
<div id="globalLink"> <a href="#" id="gl2" class="glink" onmouseover="ehandler(event,menuitem1);">About Victorb17.com</a><a href="#" id="gl3" class="glink" onmouseover="ehandler(event,menuitem2);">Diamond Opportunities </a><a href="#" id="gl4" class="glink" onmouseover="ehandler(event,menuitem3);">Entertainment</a><a href="#" id="gl5" class="glink" onmouseover="ehandler(event,menuitem4);">Learning</a><a href="#" id="gl6" class="glink" onmouseover="ehandler(event,menuitem5);">Technology</a><a href="login.html" id="gl7" class="glink" onmouseover="ehandler(event,menuitem6);">Login</a>
</div>
<!--end globalLinks-->
<form id="search" action="">
<input name="searchFor" type="text" size="10">
<a href="">search</a>
</form>
</div>
<!-- end globalNav -->
<div id="subglobal1" class="subglobalNav">
<a href="#">Blogs</a> | <a href="#">Around Town</a> | <a href="#">My Girlfriend</a> | <a href="#">Friends</a> | <a href="#">Pics</a> | <a href="#">Our Pets</a>
</div>
<div id="subglobal2" class="subglobalNav">
</div>
<div id="subglobal3" class="subglobalNav">
<a href="#">Cars</a> | <a href="#">Games</a> | <a href="#">Music</a>
</div>
<div id="subglobal4" class="subglobalNav">
<a href="#">Forums</a> | <a href="#">Knowlege Base</a>
</div>
<div id="subglobal5" class="subglobalNav">
<a href="#">Custom Programming</a> | <a href="#">Exotic Computerz</a> | <a href="#">Web Desgin</a>
</div>
<div id="subglobal6" class="subglobalNav">
</div>
<div id="subglobal7" class="subglobalNav">
</div>
<div id="subglobal8" class="subglobalNav">
</div>
</div>
<!-- end masthead -->
<div id="pagecell1">
<!--pagecell1-->
<img alt="" src="tl_curve_white.gif" height="6" width="6" id="tl"> <img alt="" src="tr_curve_white.gif" height="6" width="6" id="tr">
<div id="breadCrumb">
<a href="#">What's New?</a> / <a href="#">Guest Book</a> / <a href="#">Chat</a> /
</div>
<div id="pageName">
<h2>Home</h2>
<img alt="small logo" src="" height="59" width="66"/>
</div>
<div id="pageNav">
<div id="sectionLinks">
<a href="test.php">About Victorb17.com </a><a href="#">Cars</a><a href="#">Custom Programming</a><a href="#">Diamond Opportunities</a><a href="#">Exotic Computerz</a><a href="#">Forums</a> <a href="#">Games</a><a href="#">Knowlege base</a><a href="#">Music</a><a href="#">Web Desgin</a><a href="index.html">Home</a></div>
<div class="relatedLinks">
<h3>External Links</h3>
<a href="http://www.quadfour.net" target="blank">QuadFour.net</a><a href="http://www.cnn.com" target="blank">CNN.com</a><a href="#">Related
Link</a><a href="#">Related Link</a><a href="#">Related Link</a><a href="#">Related
Link</a></div>
<div id="advert">
<img src="" alt="" width="107" height="66" /> Advertisement copy goes here.
Advertisement copy goes here.
</div>
</div>
<div id="content">
<div class="feature">
<?php
// ok retrieve the variables from POST
$user_n = $POST['user_name'];
$pass = $POST['password'];
//if there is a missing value then ask for it.
if ($user_n == '')
{
echo 'You did not enter a user name!';
?>
<form action="register2.php" method="post" name="register" id="register">
<br>
User Name: <input name="user_name" type="text" id="user_name">
<br><br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</form>
<?php
die();
}
//connect to the db server
$conn = mysql_connect('localhost', 'victorb_victor', 'mrbo');
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}
//successfully connected to server
// make victorb17 the current db
$selected_db = mysql_select_db('victorb_victorb17', $conn);
if (!$selected_db)
{
die ('Can\'t use database! : ' . mysql_error());
}
//connected to database
// Now check to see if there is someone with that user name already in the database
$check_name = "select * from user where user_name = '$user_n'";
$result = mysql_query($check_name);
if (!$result)
{
die('Invalid query: ' . mysql_error());
}
//if it returns a row
if($row = mysql_fetch_array($result))
{
$row = false;
die('your in the db');
}
//if it does not return a fow
if (!$row)
{
echo "your not in the db";
// they do not have a user name already in use, so insert theirs
$insert_user= "insert into user (user_name, password) values('$user_n', '$pass')";
$result = mysql_query($insert_user);
if (!$result)
{
die('Invalid query: ' . mysql_error());
}
// it was sucessfully inserted, do something else here
}
mysql_close($conn);
?>
<h3 align="center"> </h3>
</div>
</div>
<div id="siteInfo">
<img src="" width="44" height="22"> <a href="#">About Victorb17.com</a> | <a href="#">Site
Map</a> | <a href="#">Privacy Policy</a> | <a href="#">Contact Info </a> | ©2005
Victorb17.com</div>
</div>
<!--end pagecell1-->
<br>
<script type="text/javascript">
<!--
var menuitem1 = new menu(7,1,"hidden");
var menuitem2 = new menu(7,2,"hidden");
var menuitem3 = new menu(7,3,"hidden");
var menuitem4 = new menu(7,4,"hidden");
var menuitem5 = new menu(7,5,"hidden");
var menuitem6 = new menu(7,6,"hidden");
var menuitem7 = new menu(7,7,"hidden");
// -->
</script>
</body>
</html>