Latest Stories

Many website applications rely on HTML forms so that users can perform their tasks. For example, most Content Management Systems allow users to provide content for a website by entering the content into a textarea form field, then clicking a "Save" button. When the user clicks the Save button, the form is submitted to the action page. The action page is normally specified with the action attribute of the form tag.

If you're not familar with HTML forms, see the HTML forms section of the HTML tutorial, then return to this page.

Once a form has been submitted, the form fields are made available to the action page as a special type of variable. You, as the programmer, can read these form variables by using the appropriate syntax for form variables. Form variables are stored as an array. We will be covering arrays later, but for now all you need to know is how to read each form variable.

Forms can be submitted using one of two methods: get or post. By default, a form will be submitted using the "get" method. This results in each form variable being passed via the URL. If you decide to use the "post" method, you specify this using the method attribute ( method="post" ) of the form tag.
The Get Method

If you use the get method, your action page can access each form field using $_GET["variableName"] (where "variableName" is the name of the form field).
Example

Form page


Display:

Code: <form action="php_action_page.cfm" method="get">
<input type="text" name="firstName" /><br />
<input type="text" name="lastName" /><br />
<input type="submit" />


Action page (php_action_page.cfm):

Here, the action page outputs the contents of the form variables that were passed from the form.
<html>
<head>
<title>PHP Form Variables Example</title>
</head>
<body>
First Name: <$php echo $_GET["firstName"]; ?><br />
Last Name: <$php echo $_GET["lastName"]; ?>
<body>

The Post Method

If your form uses the post method, you use $_POST["variableName"].

Example

Form page

Display:

Code: <form action="php_action_page.cfm" method="post">
<input type="text" name="firstName" /><br />
<input type="text" name="lastName" /><br />
<input type="submit" />

Action page (php_action_page.cfm):

Here, the action page outputs the contents of the form variables that were passed from the form.
<html>
<head>
<title>PHP Form Variables Example</title>
</head>
<body>
First Name: <$php echo $_POST["firstName"]; ?><br />
Last Name: <$php echo $_POST["lastName"]; ?>
<body>
Read More ...

Latest Stories

A Database Management System (DBMS), is a software program that enables the creation and management of databases. Generally, these databases will be more complex than the text file/spreadsheet example in the previous lesson. In fact, most of today's database systems are referred to as a Relational Database Management System (RDBMS), because of their ability to store related data across multiple tables.
Some of the more popular relational database management systems include:
  • Microsoft Access
  • Filemaker
  • Microsoft SQL Server
  • MySQL
  • Oracle
Throughout this tutorial, you will become familiar with some of the key concepts of database management systems. These include:
  • Database creation
  • Tables
  • Adding data to your database
  • Querying a database
  • Relational database design

What Does a Database Management System Look Like?

Different database management systems look different, but generally, there are a number of common features that you'll usually see across most of them.

Microsoft Access

Microsoft Access Database Management System This is the main screen you'll see when opening up Access to view an existing database. The outer part is the database management system and it's menu, the middle part is the actual database. In this example, the database is called "dateSite" and has 20 tables. If you were to open a different database, the name of the database would be different and you would see different tables, but the available options would be the same (i.e. Tables, Queries, Forms, Reports, Macros, Modules, Open, Design, New).
Some of these options are common across all database management systems. All database systems allow you to create tables, build queries, design a new database, and open an existing database.

Microsoft SQL Server

Microsoft SQL Server - Enterprise Manager Microsoft SQL Server is a more robust database management system than Access. While Access is better suited to home and small office use, SQL Server is more suited to enterprise applications such as corporate CRMs and websites etc.
The above screen is what you see when you open SQL Server through Enterprise Manager. Enterprise Manager is a built-in tool for managing SQL Server and its databases. In this example, there are 6 databases. Each database is represented down the left pane, and also in the main pane (with a "database" icon).

Which Database System to Use?

If you are using a database for home or small office use, Microsoft Access or Filemaker should be fine. If you need to create a database driven website, then you're better off using a more robust system such as SQL Server, Oracle, or MySQL.
The examples in this tutorial use Microsoft Access. If you don't have Microsoft Access, you should still be able to follow the examples. The tasks we perform are the same tasks you would need to perform regardless of which database management system you use. The key goal with this tutorial is to provide you with an overview of what is involved in creating and maintaining a database.
Read More ...