Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdown list data generator

Status
Not open for further replies.

Brianfree

Programmer
Feb 6, 2008
220
GB
hello, please can anyone assist with my request for college.

I am trying to write a program on php which does the following and then I can use on a html drop down

For the Alphabet letters.. A,B,C,D - I want to create a loop that creates the following
A-L-01
A-R-01
A-R-01
A-L-02
A-M-02
A-R-02
ETC..
Up to 32

then for the following letters, E, F - I just need to create
E-M-01
E-R-01
E-M-02
E-R-02
ETC...
Up to 20

Then for the following letters, G, H,I,J,K - I just need to create

G-L-01
G-R-01
G-R-01
H-L-02
H-M-02
H-R-02
ETC..

UP TO 20

all of this then to go into a single array which I can then call and use on a dropdown form list.

Please can anyone help? I can do it easier on an SQL table or fixing the values manually but need to do this generated via php loop.

thank you in advanced

BF
 
Why would your teacher give this assignment without teaching how to do it?
 
Hello, it was to use nested statements but having problems trying to figure it out. this is what I have so far..

<?php
foreach(range('A','C') as $location) {
foreach(range('L','M') as $position) {
for ($y = 1; $y <= 32; $y++) {
echo $location ."-". $position ."-".$y;
echo "<br>";
}
}
}
?>
 
sorry, I put on the wrong code that I was working on. You can see what I am trying to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top