<!-- nav bar -->
<?php include 'includes/navbar.php'; ?>[/php]
I would also do the top portion of your html a little differently, I can better show you than explain it, so here’s what I’m talking about. I’ll use one of my own projects.
Here’s my contact page (contact.php) :
[php]<?php
require_once ‘lib/includes/utilities.inc.php’; // This is my configuration file
use website_project\email\EmailData as Email;
use website_project\email\Contact as SendForm;
$submit = filter_input(INPUT_POST, ‘submit’, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
if (isset($submit) && $submit === ‘submit’) {
$first_name = filter_input(INPUT_POST, ‘first_name’, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$last_name = filter_input(INPUT_POST, ‘last_name’, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$name = $first_name . ’ ’ . $last_name;
$email = filter_input(INPUT_POST, ‘email’, FILTER_SANITIZE_EMAIL);
$message = filter_input(INPUT_POST, ‘comment’, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$topic = filter_input(INPUT_POST, ‘reason’, FILTER_SANITIZE_SPECIAL_CHARS);
/* Spambot check this uses a hidden Captcah technique */
$spambot = filter_input(INPUT_POST, 'subject', FILTER_SANITIZE_SPECIAL_CHARS);
$send = new SendForm(new Email($name, $email, $topic, $message, $spambot));
if (!$send->sendMail()) {
if (!$send->getName()) {
$nameError = $send->getNameError();
} else {
$displayName = $send->getName();
}
if (!$send->getEmail()) {
$emailError = $send->getEmailError();
} else {
$displayEmail = $send->getEmail();
}
if (!$send->getMessage()) {
$messageError = $send->getMessageError();
} else {
$displayMessage = $send->getMessage();
}
} else {
$success = 'Data has been successfully emailed to John Pepp';
}
}
/* This is where I have my top portion of my html */
require_once ‘lib/includes/header.inc.php’;
?>
[/php]
Here’s my top portion of my html (header.inc.php):
[php]<?php
use website_project\users\Members as gameLogin;
$gameLogin = new gameLogin($db);
$today = new DateTime(“Now”, new DateTimeZone(‘America/Detroit’));
$login = filter_input(INPUT_POST, ‘login’, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
if (isset($login) && $login === ‘login’) {
$data[‘username’] = filter_input(INPUT_POST, ‘username’, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$data[‘password’] = filter_input(INPUT_POST, ‘password’, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$result = $gameLogin->read($data);
if ($result) {
header("Location: index.php");
exit();
} else {
$errorMessage = '<span id="register">Invalid Login, Please Try Again! Need to <a href="registerPage.php">Register?</a></span>';
}
}
?>
<?php echo ($pageName === "Index") ? "Design & Development" : $pageName . " Page"; ?>
Pepster's Place
<?php if (!$user) { ?>
Username
Password
<?php echo (isset($errorMessage) && $errorMessage) ? $errorMessage : '
Need to Register?'; ?>
<?php } ?>
<?php if ($user) { ?>
<?php echo ($user) ? "
Hello " . $user->username . "!
\n" : NULL; ?>
<?php } ?>[/php]
I’m not expecting you to understand most of the code, but the main thing I trying to do is to keep the php separated as much as possible from the HTML. Maybe by getting things in order will resolve some of the issues, but I would also post more of your connection code (mysqli_) and how you connect to it. It will better help anyone trying to help you. HTH John