Whilst your files work for me it may be a server issue. See if the below code works for you. IMPORTANT save copies of your original files. The code below replaces your index.php and admin_check.php pages. It is now ALL combined into one page named index.php
<?php session_start(); ?>
<?php if (isset($_POST['button'])) {
$error_msg="";
$username=$_POST['username'];
$password=$_POST['password'];
//Simple hard coded values for the correct username & password
$admin="administrator";
$adminpass="sweety";
// connect to mysql here if you store admin username and password in your database
// This would be the prefered method of storing the values instead of hard coding them here into the script
if (($username == $admin) && ($password == $adminpass))
{
$_SESSION['admin'] = $username;
}
else
{
$error_msg='<p style="color: red;">Incorrect username & password</p>';
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Admin Check</title>
</head>
<body>
<?php if(!isset($_SESSION['admin'])) { ?>
<h2>Only the adminstrator can view the directory!!</h2></br>
<table width="417" border="0" cellspacing="1" cellpadding="0">
<form action="index.php" method="post" target="_self">
<tr>
<td colspan="2"><b>Please Log in here</b><?php if(isset($error_msg)) { echo $error_msg; } ?></td>
</tr>
<tr>
<td width="100" height="46">User Name</td>
<td width="314"><label for="username"></label>
<input name="username" type="text" id="username" style="width:98%"></td>
</tr>
<tr>
<td height="41">Password</td>
<td><label for="username"></label>
<input type="password" name="password" id="password" style="width:98%"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="button" id="button" value="Log In"></td>
</tr>
</form>
</table>
<a href="../">Click here to head back to the home page</a>
<?php } else { ?>
<table width="100%" border="0" cellpadding="8">
<tr>
<td><h3>DevelopPHP's Basic PHP + MySQL Page Edit System • <a href="index.php">Admin Home</a> • <a href="../">View Live Website</a></h3></td>
</tr>
<tr>
<td>Hello Admin, what would you like to do?<br /></td>
</tr>
<tr>
<td bgcolor="#DAF2FE"><h3><a href="create_page.php">Create New Page</a></h3></td>
</tr>
<tr>
<td bgcolor="#D5FFD5"><form id="form1" name="form1" method="post" action="edit_page.php" onsubmit="return validate_form1 ( );">
<br />
<input type="submit" name="button2" id="button2" value="Edit Existing Page" />
<input name="pid" type="text" id="pid" size="8" maxlength="11" />
<<<< place ID of the page to be edited here<br />
<br />
</form></td>
</tr>
<tr>
<td bgcolor="#FFDDDD"><form id="form2" name="form2" method="post" action="page_delete_parse.php" onsubmit="return validate_form2 ( );">
<br />
<input type="submit" name="button" id="button" value="Delete Page" />
<input name="pid" type="text" id="pid" size="8" maxlength="11" />
<<<< place ID of the page to be deleted here<br />
<br />
</form></td>
</tr>
</table>
<?php } ?>
</body>