Require is giving me issues
Posted: Tue Jul 24, 2007 12:02 am
The following is just test code. The difference of one line of code is the difference between my form displaying and nothing happening. Can you guess which one it is?
No? It's the second "require()" line. That file is there. I don't even call it yet, but it's requirement is halting my script, but no errors are being reported. It's very strange.
No? It's the second "require()" line. That file is there. I don't even call it yet, but it's requirement is halting my script, but no errors are being reported. It's very strange.
Code: Select all
<?php
require 'dbvars.php';
require 'includes/MySQLConnect.php';
if (isset($_POST['submitted'])) {
$errors = array();
if (empty($_POST['username'])) {
$errors[] = "Please enter your username.";
} else {
$username = $_POST['username'];
}
if (empty($_POST['password'])) {
$errors[] = "Please enter your password.";
} else {
$password = $_POST['password'];
}
if (empty($errors)) { //if there are no errors
echo "There were no errors";
} else {
echo "There were errors";
}
} else {
$pageTitle = "Login";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $pageTitle; ?></title>
</head>
<body>
<div id="header">
<h1 class="large">employee-facing registry content</h1>
</div>
<div>
<form action="login.php" method="POST">
<p id="name" class="input">name: </p>
<input type="text" name="username" />
<br />
<br />
<p id="password" class"input">password: </p>
<input type="password" name="password" />
<br />
<br />
<input type="hidden" name="submitted" value="true" />
<input type="submit" name="yay!" />
</form>
</div>
</body>
</html>
<?php
}
?>