October 2009
Beginner
408 pages
7h 27m
English
Saving the page an entry is associated with is as easy as adding another input to your form. However, there are a couple reasons you don't want to require the user to fill out the page an entry belongs on. First, it's inconvenient for the user; second, it increases the risk of typos or confusion.
Fortunately, HTML forms allow you to insert hidden inputs, which contain a value that is passed in the $_POST superglobal, but isn't displayed to the user. In your admin.php script (full path: /xampp/htdocs/simple_blog/admin.php), add a hidden input to your form by inserting the lines in bold:
<?php
if(isset($_GET['page']))
{
$page = htmlentities(strip_tags($_GET['page']));
}
else
{
$page = 'blog'; ...Read now
Unlock full access