I'll keep it short...
I have coded I ccpied to Notepad (from a tutorial of a book). It doesn't work, I get a blank screen when I run it. I have my global variables set to "on" (but it shouldn't matter the way this is coded?). The code is a simple form and form handler all in one file.
<?PHP
$page_title = "Register!";
include('./php/header.inc');
if (isset($_POST['submit'])) {
if (strlen($_POST['name']) >0) {
$name = TRUE;
} else {
$name = FALSE;
echo '<p>You forgot to enter your name!</p>';
}
if(strlen($_POST['email']) >0) {
$email = TRUE;
} else {
$email = FALSE;
echo '<p>You forgot to enter your email address!</p>';
}
if(strlen($_POST['username']) >0) {
$username = TRUE;
} else {
$username = FALSE;
echo '<p>You forgot to enter you user name!</p>';
}
if(strlen($_POST['password1']) >0) {
if($_POST['password1'] == $_POST['password2']) {
$password = TRUE;
} else {
$password = FALSE;
echo '<p>Your password did not match the confirmed password!</p>';
}
} else {
$password = FALSE;
echo "You forgot your password!";
}
if($name && $email && $username && $password) {
echo "<p>You are registered</p>";
} else {
echo '<p>Please go back and try again!</p>';
}
} else {
?>
<form action= "<?php echo $_SERVER['PHP_SELF'];?>" method= "post">
<fieldset><legend>Enter you information in the form below</legend>
<p><b>Name:</b><input type= "text" name= "name" size= "20" maxlength= "40"></p>
<p><b>Email Address:</b><input type= "text" name= "email" size= "40" maxlength= "60"></p>
<p><b>Username:</b><input type= "text" name= "username" size= "20" maxlength= "40"></p>
<p><b>Password:</b><input type= "text" name= "password1" size = "20" maxlength= "40"></p>
<p><b>Confirm Password:</b><input type= "password" name= "password2" size= "20" maxlength= "40"></p>
</fieldset>
<div align= "center" type= "submit" name= "submit" value= "Submit Information">
</div>
</form>
}
<?php
include("./php/footer.inc");
?>