I'm making a small 'script' in php, and am having some problems in which I have no idea what the problem is.
I'm working on the install part first, in which you put the data in forms, etc etc etc, and on the next page it processes everything, makes sure everything is filled in. If everything isn't filled in, it makes a variable called '$installErrorMessage' and assigns an error message to it. It also makes a boolean, '$installErrorBol' true if there is a problem. It is all the made into $_SESSION[' '] form and you're redirected to the initial installation page, where if the $_SESSION[' '] is set it displays it in a nice red box.
This is the processing page:
CODE
<?php
// Initiate session.
session_start();
// Redirect back to installation index.
header("location: Index.php");
// Make sure variables are usable.
if ( (!isset($_POST['dbUser'])) || (!isset($_POST['dbPass'])) || (!isset($_POST['dbHost'])) || (!isset($_POST['dataBase'])) || (!isset($_POST['tablePrefix'])) || (!isset($_POST['adminUser'])) || (!isset($_POST['adminPass'])) || (!isset($_POST['adminPassCheck'])) || (!isset($_POST['adminMail'])) || (!isset($_POST['adminMailCheck'])) )
{
$installErrorMessage = "One or more fields were not filled in. Please make sure all fields are accurately filled in";
$installErrorBol = true;
}
// If there is an error, send error message to index page.
if (isset($installErrorBol) && ($installErrorBol = true)) {
$_SESSION['installErrorMessage'] = $installErrorMessage;
}
?>
Here is the main part of Index.php where you input data:
CODE
<?php session_start(); ?>
<!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=iso-8859-1" />
<title>CentSB - Installation</title>
<link rel="stylesheet" type="text/css" href="../Common/Common.css" />
</head>
<body style="background-color: #CCCCCC;">
<center>
<div style="border-width: thin; border-color: #00CCFF; border-style: solid; width: 500px;"
<div style="background-color: #33CCCC; width: 500px; height: 35px;"> Welcome to CentSB Installation. Please fill out the following forms to continue with installation.<br /></div>
<div style="background-color: red;"><?php if (isset($_SESSION['installErrorMessage'])) { echo $_SESSION['installErrorMessage']; } ?></div>
From experimenting, I found that in the install_Go.php (processing page) the problem is that it doesn't detect that the elements are missing.
Oh, and because the <input> forms have an initial value (value="etc"), if the person doesn't edit that, it counts as if they did, right? Or do browsers not count that?
Oh, and the initial problem - It doesn't show the error message when it redirects. And not everything was filled.