Graphics Programs Reference
In-Depth Information
• Add server behaviors to the form to connect the database.
• Add server behaviors to view the data collected in the database from within the desig-
nated Web pages.
• Format the login page.
• Set the database pages to display only when a user has logged in.
If you are working on a Linux server with MySQL and PHP, continue with the rest of
Session 9.1. If you are working on a Windows server with Access and ASP, continue with
Session 9.2. If you are unsure which type of server you are using or if you do not have
access to a server, check with your instructor or technical support person before continu-
ing with this tutorial.
Creating Database-Driven Pages Using
MySQL and PHP
Adding database functionality to a Web site can be quite complex. Just as it is a good
practice to make a plan prior to creating a Web site, it is also a good practice to plan the
database-driven portion of the site in advance. Gage created a site plan for the new por-
tion of the NextBest Fest site.
Based on Gage's plan, the technical team will create the SQL for a database that stores
the information collected from the form in the contact.html page. You will modify the
form to work with the database. You'll create the pages for the new portion of the site:
thankyou.html, access_denied.html, database.php, database_details.php, and login.php.
You'll create the database on the remote server using the SQL provided by the technical
team, and then you'll connect the site to the database. Next, you'll add server behaviors
to the pages you created so that the form data can be sent to and stored in the database
and so that the database.php and database_details.php pages display the information
stored in the database. Finally, you'll create a login.php page and add code to the back-
end pages to prevent unauthorized users from viewing the content of those pages.
When the database-driven pages are complete, the information received from users
who completed the form in the contact.html page will be stored in a database that only
authorized users can access.
Creating Database-Driven Pages for a Linux Server
• Create the Web pages you need.
• Create a database on your remote server.
• Add server behaviors to connect the site to the database.
• Add server behaviors to store submitted data in the database and to view the data col-
lected in the database from within designated Web pages.
• Create a login page.
• Add code to the back-end pages to prevent unauthorized users from viewing the con-
tent of those pages.
Modifying the Form
Before you create the database-driven pages of the NextBest Fest site, you'll modify the
form in the contact.html page to work with the database that you will create on your
remote server. You will delete the list box with the band names from the form, and then
create a series of check boxes to collect this same information. You are replacing the list
box with the check boxes to keep things simpler because a list box as the storage ele-
ment requires more steps and custom scripts to process data.
Search WWH ::




Custom Search