Not sure what you're trying to do here:
if (isset($_GET['action']) == 'addpage' && isset($_POST['submit'])) {
Let's look to see what [man]isset/man will return:
Returns TRUE if var exists; FALSE otherwise.
Hmm... so if
true == "addpage"
and the submit button is set........ seems like as long as the submit is pressed then "addpage" will be true... so it's probably catching in the first loop.... and now you've got unknown keys for arrays because what was submitted isn't what you're looking for 😉
So really, your check should be:
<?php
} else {
include('pages/mainPage.html');
if(isset($_GET))
{
if($_GET['action'] == 'addpage' && isset($_POST))
{
}
else if($_GET['action'] == 'addpage')
{
}
/**
* Etc.... Etc..... Etc....
*/
}
}
?>
and the whole session username thing... could be because $_POST['username'] is empty 😉