http://www.dandesign.co.uk/steel/register.php
above is the link to my register page, filling the form in works fine but if you leave it blank and click the submit button it removes the footer of my page, please someone help i really need to get this sorted
heres the code to my page too, im not great at php so its a little messy:S
<?php
session_start();
include("database.php");
include("login.php");
/**
* Returns true if the username has been taken
* by another user, false otherwise.
*/
function usernameTaken($username){
global $conn;
if(!get_magic_quotes_gpc()){
$username = addslashes($username);
}
$q = "select username from customer where username = '$username'";
$result = mysql_query($q,$conn);
return (mysql_numrows($result) > 0);
}
/**
* Inserts the given (username, password) pair
* into the database. Returns true on success,
* false otherwise.
*/
function addNewUser($username, $password){
global $conn;
$q = "INSERT INTO customer (Firstname, Surname, Company, Email, Type, Tel, Mob, username, password) VALUES ('$_POST[first]', '$_POST[surn]', '$_POST[comp]', '$_POST[email]', '$_POST[type]', '$_POST[tel]', '$_POST[mob]', '$username', '$password')";
return mysql_query($q,$conn);
}
/**
* Displays the appropriate message to the user
* after the registration attempt. It displays a
* success or failure status depending on a
* session variable set during registration.
*/
function displayStatus(){
$uname = $_SESSION['reguname'];
if($_SESSION['regresult']){
echo ("Registered!");
}
else{
?>
<form action="<?php echo $HTTP_SERVER_VARS['PHP_SELF']; ?>" method="post">
<h1>Register Form</h1>
<p>Personal Details</p>
<label>First Name:<span class="small">Add your name</span></label><input type="text" name="first" />
<label>Surname:<span class="small">Add your name</span></label><input type="text" name="surn" />
<label>Company:<span class="small">Add your name</span></label><input type="text" name="comp" />
<label>Email:<span class="small">Add a valid address</span></label><input type="text" name="email" />
<label>Customer<span class="small">Add your name</span></label><input type="radio" name="type" align="left" value="cus" />
<label>Stockist<span class="small">Add your name</span></label><input type="radio" name="type" align="left" value="stk" />
<label>Telephone:<span class="small">Add a valid address</span></label><input type="text" name="tel" />
<label>Mobile:<span class="small">Add a valid address</span></label><input type="text" name="mob" />
<label>Username:<span class="small">Min. size 8 chars</span></label><input type="text" name="user" />
<label>Password:<span class="small">Min. size 6 chars</span></label><input type="password" name="pass" />
<button type="submit" name="subjoin">Sign-up</button>
<input type="hidden" name="MM_insert" value="fact_form_id" />
</form>
<?php
}
}
?>
<!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>
<link href="css/main.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body class="thrColElsHdr">
<div id="container">
<div id="header">
<div id="styli">
<?php displayLogin(); ?>
</div>
</div>
<div id="sidebar1">
<ul id="MenuBar1" class="MenuBarVertical">
<li><a href="index.php">Home</a></li>
<li><a class="MenuBarItemSubmenu" href="#">Quote Generator</a></li>
<li><a href="factor_form.php">Login/Register</a></li>
<li><a href="#">News</a></li>
<li><a href="#">Help/FAQ</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Legal</a></li>
</ul>
<div id="news">
<h1>News</h1>
<h2>30.07.10 - News 1</h2>
<p>Lorem ipsum diam nonumy eirmod tempor. Invidunt ut labore et dolore magna...</p>
<h2>06.08.10 - News 2</h2><p>We have developed the site to make it 10x faster than before, so you can get your qoutes when you need them...</p>
</div>
<div id="guarantee">
<h1>The Mission Statement...</h1>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor. Invidunt ut labore et dolore magna aliquyam erat, seddiam voluptua.</p>
</div>
</div>
<div id="sidebar2">
<h3>SideBar2 Advert</h3>
<p></p>
<p></p>
</div>
<div id="mainContent">
<div id="main_img"></div>
<div id="main_body">
<div id="stylized" class="myform">
<?php displayStatus(); ?>
<?php
if(isset($_POST['subjoin'])){
/* Make sure all fields were entered */
if(!$_POST['user'] || !$_POST['pass']){
die("<p>You didn't fill in a required field</p>");
}
/* Spruce up username, check length */
$_POST['user'] = trim($_POST['user']);
if(strlen($_POST['user']) > 30){
die("<p>Sorry, the username is longer than 30 characters, please shorten it</p>");
}
/* Check if username is already in use */
if(usernameTaken($_POST['user'])){
$user = $_POST['user'];
die("<p>Sorry, the username: <strong>$user</strong> is already taken, please pick another one</p>");
}
/* Add the new account to the database */
$md5pass = md5($_POST['pass']);
$_SESSION['reguname'] = $_POST['user'];
$_SESSION['regresult'] = addNewUser($_POST['user'], $md5pass);
$_SESSION['registered'] = true;
echo "<meta http-equiv=\"Refresh\" content=\"0;url=$HTTP_SERVER_VARS[PHP_SELF]\">";
return;
}
?>
</div>
</div>
</div>
<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
<div id="footer">
<p><a href="index.php">Home</a> | Login Customer | <a href="factor_form.php">Login Factor</a> | News | Help/FAQ | Contact | Legal | Terms & Conditions</p>
<p>Tel: 0114 XXX XXXX | Fax: 0114 XXX XXXX</p>
</div>
<!-- end #container --></div>
<div id="design">
<p>Website Designed by: <strong>Fissure Design</strong></p>
</div>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
</html>
<?php
unset($_SESSION['reguname']);
unset($_SESSION['registered']);
unset($_SESSION['regresult']);
?>