11.2. Adding Administrators in the Database

You have a place to store administrators; now you're ready to start creating them. Your first step is to create a form that allows you to enter a username and password in an HTML form. Once you accomplish this, you need to store the information in the database for later use.

11.2.1. Building an HTML Form

To build your HTML form, you need to write a new function, named createUserForm(). When called, this function returns a string of HTML that displays a form that asks for a username and password for the new admin.

You can add the code in bold to functions.inc.php to make the createUserForm() function:

function createUserForm()
{
    return <<<FORM
<form action="/simple_blog/inc/update.inc.php" method="post"> ...

Get PHP for Absolute Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.