All examples on the page are located in php sample site
On all the tutorial pages, You'll See:
In the Pets page, you'll see your menu. This page contains no PHP code and therefore is NOT given the .php extension, although it calls pages that are.
To Make a Form a PHP Form:
In general, to create a PHP form page, create a layout region, and make is a "form" . You don't have to make the entire page to be a form, but you can if you would like:
Once the "Form" check box has been checked, click on "Settings" and make the form Method "POST" with the Action to be the name of the NOF or other .php file that is being called to do the database work.
Breaking the form into 2 pages, 1 to display the form and 1 to process what gets entered makes the form very easy to follow. It also creates a method of being able to update one without impacting the other :).
Form Page Layout
If your form has no self populating fields like combo boxes or multi-list fields, then you do not even need to open and connect to the database. You can simply create the form.
If however, you do want your form to have fields that are filled in, you will need to open the database to retreive those records. Our Pets all have Owners who are already pets of Team GotFusion, so all the Pet Form Pages do open the database
What else does Call Script Form Pages have? A Form with an action that calls a corresponding NOF .php or external .php page and that corresponding .php page that performs the action on the database. Look at our sample site view:
The Processing Page Format
Each page that performs the processing in the Call Script method. If the page does have content that is displayed, it is a good idea to use the same MasterBorder as the page with the form on it. This provides for continuity.
OK... Let's process some data....
ADD Pet (the pets are fictitious. Any association or resemblance to actual TGF pets is purely coincedental)
UPDATE Pets information (Is pet swapping allowed?)
DELETE A Pet (Poor old Fluffy :) )
next lesson - Adding records
|