0

I am writing a PHP registration form but when i view my page i cannot see the form, any ideas all my code is below.

i have noticed that if i remove the

print '<h1> Please Register To Continue </h1>';
print '<style type="text/"
		media="screen>
		.error { color: red; }
		</style>';

my form is displayed but none of my error messages are

register.php

<?php  

define('TITLE', 'Register');
include('header.html');

print '<h1> Please Register To Continue </h1>';
print '<style type="text/"
		media="screen>
		.error { color: red; }
		</style>';
		
if ( isset($_post['submitted']) ) {
 
$problem = FALSE;

if (empty($_POST['fname'])) {
$problem = TRUE;
print '<p class="error">Please Enter Your First Name!</p>';
}
if (empty($_POST['lname'])) { 
$problem = TRUE;
print '<p class="error">Please Enter Your Last Name!</p>';
}
if (empty($_POST['email'])) {
$problem = TRUE;
print '<p class="error">Please Enter Your Email Address!</p>';
}
if (empty($_POST['password1'])) { 
$problem = TRUE;
print '<p class="error">Please Enter A Password!</p>';
}
if ($_POST['password1'] != $_POST['password2']) {
$problem = TRUE;
print '<p class="error">Please Enter A Password!</p>'; 
}
if (!$problem) {
print '<p>blah blah need to do this bit of script to MySQL still</p>';
$_POST = array();
} else {
print '<p class="error">Please Try Again</p>';
}
}
?>

<form action="register.php" method="post">

<p>First Name: <input type="text" name="fname" size="20" value="<?php if (isset($_POST
['fname'])) { print htmlspecialchars($_POST['fname']); } ?>" /></p>

<p>Last Name: <input type="text" name="lname" size="20" value="<?php if (isset($_POST
['lname'])) { print htmlspecialchars($_POST['lname']); } ?>" /></p>

<p>Email: <input type="text" name="email" size="20" value="<?php if (isset($_POST
['email'])) { print htmlspecialchars($_POST['email']); } ?>" /></p>

<p>Password: <input type="password" name="password1" size="20" /></p>

<p>Confirm Password: <input type="password" name="password2" size="20" /></p>

<p>Password: <input type="submit" name="submit" value="Register" /></p>

<p>Password: <input type="hidden" name="submitted" value="true" /></p>

</form>

<?php include('footer.html'); ?>

header.html

<!DOCTYPE html PUBLIC "-//WC3//DTD// XHTML 1.0 Transitional//EN">
<html xmins="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Register</title>

<style type="text/css">
		body {
			margin: 0px 0px 0px 0px;
			background: #9F9;
			}
		#leftcontent {
			float: left;
			width: 67%;
			background: #fff;
			border-right: 2px solid #000;
			border-bottom: 2px solid #000;
			margin-right: 15px;
			padding-bottom: 20px;
			}
		p,h1,pre {
			margin: 0px 30px 10px 30px;
			}
		h1 {
			font-size: 14px;
			padding-top: 10px;
			}
		#rightcontent p {
			font-size: 14px;
			margin-left: 0px;
			}
</style>

</head>
<body>
<div id="leftcontent">
<!-- BEGIN CHANGEABLE CONTENT --!>

footer.html

</div>

</body>
</html>

Edited by daryll1: n/a

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by daryll1
0
print '<style type="text/"
		media="screen>
		.error { color: red; }
		</style>';

This is wrong. You have a mess. If you delete this the form will show. You have an unclosed ". So everything that follows is assumed to be an attribute value until we reach the next ".

<style media="screen">.error { color: red;}</style>';

The above should be in the 'head' area not in the 'body'.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.