gotFusion.com....... Where your adventure begins
Antons Video ProductionsNetObjects Fusion 7 Websites Portal

 


 

In This Tutorial

MySQL--Getting Started

SELECT Statements

Forms

On All Forms

Forms-Add

Forms-Update

Forms-Delete

Combo Boxes

All the Examples on this page can be found in the php sample site

Why would we WANT to do this?

Using self populated pulldowns and multi-list boxes provides us with some increased data integrity.

  • Provides improved relationships between tables w/o user intervention
  • Keeps duplicates minimal
  • Fast and easy (faster than typing :) )
  • Helps new users who are not sure what information to put into the field
  • Enforces data integrity

  
Choose which pet to delete

Some PHP code required in order to retrieve the list of Pets for the combo box and to delete:

open db, count and only allow to delete if there are pets to delete

Lets skip over the form properties since we are looking at the actual contents of the combo box itself. Click on the combo box and select HTML:

click on HTML to see how we populated the combo box

Inside the HTML tag, we see the PHP code that populates the box. Remember, we can add php code ANYWHERE HTML can be inserted, since the server interprets the php code BEFORE the browser is actually loaded.

Code used to populate the box

We want to do 3 basic things

  1. Select the table columns to populate. In our example above, we selected the petid, petname, and the owner's nickname. We only display the petname and nickname, but the petid will be used to pass to the next page to process the activity (in this case to delete). We use the petid since it is unique with no duplicates so we don't accidentally delete the wrong pet.
  2. Pad the combo box with a "dummy" menu item. The echo statement can be anything. Since HTML/NOF begins incrementing with 1, but PHP begins incrementing with 0, if we did not pad in a dummy combo box menu choice, we would lose the first item retrieved.
  3. While there are records to be displayed, echo them to the screen. Since we are inside the combo box, they will be plugged into the combo box or multi-list box very nicely :)... cool huh?

 

Look and review the other combo boxes or multilist boxes to see that they are very similar in nature.

View the PREVIOUS page in this tutorial

Return to the TOP of this page

View the NEXT page in this tutorial


|  Fusion  |  Web Design  |  Hosting  |  Resources  |  gotFusion Store  | 

Problems with this page?  

All content copyright © 2002 gotFusion LLC.  The name gotFusion and the gotFusion ® logo are registered trademarks of gotFusion LLC
Copyright, legal notice & privacy statement