Web Hosting, Design, & Coding forum

General discussion

Select box values...

by dsho / September 25, 2004 9:04 PM PDT

Salutations!

I am using HTML and JSP to design a user interface to store data in a MySQL table.

Data Input:
Using text boxes to get data strings
e.g. Standard, Deluxe, Suite

These values will be stored in the MySQL table. I would like to retrieve these values and populate a Select Box.

Is this possible?

I was thinking of getting the values via a comma-delimited string and store it as a string in the table. And then, with this string, I slowly parse it to get values for the select box.

Is there any other way?

Thanks for any replies.

dsho

Discussion is locked
You are posting a reply to: Select box values...
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Select box values...
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
Re: Select box values...
by R. Proffitt Forum moderator / September 25, 2004 9:32 PM PDT
In reply to: Select box values...

I will not duplicate PHP/MySQL web sites with examples, but the solution is to have a web server that creates the HTML dynamically so it is as you want.

Bob

Collapse -
Re: Select box values...
by slim___shady / September 26, 2004 11:45 AM PDT
In reply to: Select box values...

I'm thinking in terms of ASP but i would think JSP couldn't be much different.

I would just type the select tag like normal and then, script a loop to traverse through the table until eof. Each loop would input an option tag with the current record. End loop

Collapse -
Re: Select box values...
by dsho / September 28, 2004 2:48 PM PDT
In reply to: Select box values...

Salutations!

Thanks for all the replies.

My bad. I cannot describe the effect I wanted. But, I am using a loop to do the <select> box. I realised that I have to write some code to do it.

Data Input:
1. Multiple textbox to collect new roomType and roomPrice values.
2. Concatenate the type/price pairs into one string with delimiters.
3. Store the data in mySQL table.

Data Edit:
1. Retrieve data from mySQL table.
2. Parse delimited string to get type/price pairs.
3. Populate <select> with the type values.
4. Show corresponding price in texbox for currently selected <option>.
5. Change textbox value with onChange() in <select>.
6. Concatenate the type/price pairs into one string with delimiters.
7. Store the data in mySQL table.

Data Viewing:
1. Retrieve data from mySQL table.
2. Parse delimited string to get type/price pairs.
3. Use a loop to display the data.

I was hoping for a different approach.

dsho

Collapse -
Re: Select box values...
by alwayLearning / October 22, 2004 11:28 AM PDT

Why are you concatenating the values? Why not store each in a seperate field in your table? (not familiar with mySql so that may be a dumb question but just pulling the record set and looping would be faster to process than doing string manipulations)

Popular Forums
icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

The Samsung RF23M8090SG

One of the best French door fridges we've tested

A good-looking fridge with useful features like an auto-filling water pitcher and a temperature-adjustable "FlexZone" drawer. It was a near-flawless performer in our cooling tests.