PHP Tutorial - For Loop
Introduction
This tutorial will allow you to make a really easy number selecting dropdown menu, using PHPs for() loop.Step 1
Start by just making the basic HTML code for a dropdown menu, which is the SELECT HTML tag.Step 2
Now we have the beginnings of the dropdown selection, we need to add the PHP for() loop in it. We need to now tell the PHP to continue to, lets say 35, so to do this we add the for() loop.If you are currently lost then I will explain each bit to you individually. The for() loop holds 3 properties, where $i=1 is, tells the loop to start from the value of 1. The <=35 bit tells it how much to go upto, then the $i++ tells the loop to count UP to that amount.
Step 3
With the for() loop now working, you can now add in the OPTION values within the PHP for() loop, with the value of $i.Result...
The result will now be viewable if you save that as a PHP file and upload it to your webserver (or localhost). An example of it is below.Comments
Comments:
27th Jul 2007 10:41
thanks a lotBy meno
24th Jul 2007 16:40
Thanks.It's good!By Dudu
2nd Aug 2007 5:04
good! ;DBy Dinho
Add your comment...
| Latest News Stories » Pectus Excavatum - Catchup » Pectus Excavatum - The Final Chapter » Pectus Excavatum Operation » One Dream That Won't Be Fulfilled... » Hotpoint WIXXE127 on Twitter Trends » Google StreetView: Superheroes found in Blackpool | Top Viewed Stories » PHP Mini Message Board Tutorial (41,067) » Bypass Photobucket (32,491) » PHP Search Engine Tutorial (29,452) » Getting .htaccess on AppServ (Windows) to work (23,746) » Rare McDonalds Monopoly 2008 Tickets (11,954) » Helen Willetts Pregnant? (9,587) |
Most Commented Stories » PHP Mini Message Board Tutorial (101) » PHP Search Engine Tutorial (37) » Create your own Image Uploader (23) » Pectus Excavatum (20) » I like my DuMP (15) » New Shameless Trailer! (10) |






