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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic drop down box

Status
Not open for further replies.

mrtopher

Programmer
Joined
Aug 27, 2003
Messages
34
Location
US
My issue is rather difficult to explain, but I hope you will be able to understand. I have written a scheduling program for a summer camp. Admin users can create classes and when they do they select times that the class will be held. Users can then log in and sign up for these classes.

I have made a sign up form that creates eight drop down menus dynamically listing only the classes offered at the time period (this information is gathered from a database). My issue is that I want people to be able to edit this information later on and I don’t know how to make it so that the drop down menus that are created will display the classes this person has signed up for.

I would pass the form the variables through the URL or something but I don’t know how to make the drop down menus display those values. I know how to do it if the drop down menu is static (already made) but being that the menus are dynamically made on the fly I am at a loss.

I hope I haven’t confused you to much. If you need clarification please let me know. I could really use some help on this one!!!
 
Are you using a database? If so which one?
I would not recommend that you use URLs to pass these values.URLs have size limits and we cannot hide these values from anybody.
This shoould be done using sessions or direct database fetch.
 
I am using a MySQL database to generate the drop down boxes initally. I am talking about having the form already filled in with values that a person has been signed up for. I guess I could get that information from the database as well, but I just used that as an example. How would I go about having the drop down boxes display the value that the person is signed up for.

This is the function I have made the make the drop down box, maybe it will help.

function print_options($time)
{
$query = "select badge_name, badge_code from badge_master where time_$time = '1'";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);

for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo '<option value=&quot;' . $row['badge_code'] . '&quot;>' . $row['badge_name'] . '</option>';
}
}
 
if you make the person login in your database you can use the loginid for your select statement to limit the results only where he has signed up for (where his id is also registered)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top