The Chapter3 & Chapter4 of this book tells the "Create a realistic app on the web through the lab.
That's really amazing when you finished yourself. I'll show you the it as follows.
First of all, we need a plan of what to do an application, generally speaking, can following the steps like this (as W E did it in the LAB1):
1. Create a database and table for the app (the email list)
2. Create and edit a Web form for the customer
3. Create and edit a PHP script to handle the Web Form
To Finish the application, we should start with the table, actually, it all starts with a database.
Step 1:
These command line with MySQL: the.
CREATE DATABASE Elvis_store
Then you need to create a table inside the database, just like we do in the LAB1, but beofore you create tables, please
Make sure your selected the database or you'll get an ERROR. This command could help you with it:
Use Elvis_store
Next You can create table (s) inside the This database, table structure are based on your application, the This app can Desig n the table like this:
CREATE TABLE email_list ( varchar ),varchar , VARCHAR );
View Code
It is quite simple, yeah? Next we'll move to Step2:
Step2:
Make a directory to store this application, you can name it LAB2 or anything you want, and add some HTML files && CSS files to it:
/*** addemail.html ***/
<! DOCTYPE html Public"-//W3c//DTD XHTML1.0Transitional//EN "" http://www.w3.org/Tr/Xhtml1/Dtd/Xhtml1-Transitional.dtd "><HTML xmlns="http://www.w3.org/1999/XHTML "Xml:lang="En" lang="EN"><Head> <Meta HTTP-Equiv=The Content-Type "Content="text/html CharSet=Utf-8"/> <Title>Make Me Elvis- ADDEmail</Title> <Link rel="Stylesheet" type="text/CSS "href="Style.css"/></Head><Body> <IMG SRC="Blankface.jpg" width="161"Height=" -The Alt="" Style="float: Right"/> <IMG Name="Elvislogo" src="Elvislogo.gif" width="229"Height=" +"Border="0The Alt="Make Me Elvis"/> <P>Enter your first name, last name, andEmail tobe added toThe<Strong>Make Me Elvis</Strong>Mailing list.</P> <Form method="POST" action="Addemail.php"> <Label for="FirstName">First Name:</Label> <input type="textThe ID="FirstName" name="FirstName"/><Br/> <Label for="LastName">Last Name:</Label> <input type="textThe ID="LastName" Name="LastName"/><Br/> <Label for="Email">Email:</Label> <input type="textThe ID="Email" name="Email"/><Br/> <input type="Submit" Name="Submit" value="Submit"/> </Form></Body></Html>
View Code
/*** Style.css ***/
{ font-family: Arial, Helvetica, Sans-serif; font-size: 12px;}
View Code
If you run it on the Your Apache Server, you'll get a page like this:
Its just a simple form and serveral CSS. Very simple. Now we have finished Step2.
The only thing we need to notice are that this form ' s action = ' addemail.php ' which means it'll send this form to the FIL E on the Server.
Lets move to the step3. If you are probably know how to does it, yes create an edit addemail.php file on the Server.
STEP3:
#2 Create and populate a database && realistic and practical applications