For the first part of question, dynamically populating the second drop down menu based on what is selected with the first is a JavaScript question.
For the second part of the question, PHP has a number of built-in functions for handling text files.
Here's a simple example of getting the contents of a text file.
This approach uses the fgetcsv function, since the text file is structured like a csv file. (comma separated values)
http://www.php.net/fgetcsv
Code:
// Open the products.txt file read only.
$handle = fopen('products.txt', 'r');
// iterate through each line of the file.
// read up to 1000 characters per line of data, use a semi-colon instead of a comma as the data separator.
while (FALSE !== ($data = fgetcsv($handle, 1000, ';')))
{
// $data is an array that contains all of the information from that line.
$product[] = $data[0];
$inventory[] = $data[1];
}
fclose($handle);
This should produce output like this:
Code:
$product[0] = 'racket';
$inventory[0] = '3 available';
$product[1] = 'shuttlecock';
$inventory[1] = '6 available';
//.. etc.
Then at this point you can populate a <select> element with the data. If I have time I'll demonstrate how to do the javascript part of it later (not-with-standing that someone else on the list doesn't do it in the meantime:)).
HTH!
Regards,
Rich
::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::