MySQL & PHP SelectBox | 3-part question

I have what I think is a three-part question regarding the creation of a PHP-based computer system configurator:

I currently have 12 HTML/javascript-based computer configurator pages that I developed several years ago, but have recently switched our site over to PHP. I have learned a bit of PHP during the conversion, but am not a serious PHP developer. Problem: I must quickly build a database-driven configurator in order to make site updates less of a monumental chore. The good news? -The site and database are already built, connected and running fine...the only thing I need is the way to pull data into the configurator and have the items auto-total. The bad news? -I want to use the least amount of different HTML templates for the many different types of machine profiles we sell. Optimally, one template should be used with the page data and images altering based on the type/profile chosen by the user.

For the most part, the HTML template for the configurator is already built (it's currently up and running fine using the JS+HTML method), but I REALLY need to find/learn a way to create PHP drop-down select boxes populated from an existing MySQL database (I would love to get away from having to adjust 12 different javascripts each time I want to change some component's driving me to drink...and not in a good way  8-/  
-These select boxes have to populate based on the processing platform (AMD or Intel) and the profile-type (gaming, professional, server, etc.). The page must also have an auto-updating price total that reflects the sum of all the user-selected choices.

Here is the question(s):

1). What would be a good code example of how to best create the pages based on machine type? Should I use URL query strings on preceding pages to designate how the configurator pages are built?
2). Does anyone have a script that can show me how to pull data into a PHP selectbox? I have a basic understanding, but want to do it right the first time.
3). How on earth can I get the PHP selections to auto-total after a user makes a selection? Is this something I'll still have to incorporate javascript in the pages to do or is there a PHP function that can do it for me?

If you need more specific info in order to present a defined answer, please ask.

-A metric ton of thanks for your suggestions.



Who is Participating?
mxaveConnect With a Mentor Commented:
You should browse through the manual and search for array.
Below are the links where you can learn more about PHP Array Logic and DB Query

- (Creating array from DB)

I know one nice commercial script at which does everything you need.
1. You can do so by passing the URL strings across the pages. If you want better, you may use either session or cookies to store the configuration values.

2. If you use Macromedia Dreamweaver, you can pull the data into php select box by using DataRecordSet. Or you define all the values in database as array and then print out in the select box by using php echo.

3. You can use simple PHP calculation to calculate the total prices. You just have to define all the fields used in the configurator as PHP constants . Then you have to plus total together and output the prices on the next page.

Hope this will help you, let me know if you have any problem.
J_D_HAuthor Commented:
Hey, thanks mxave, 'preciatecha. But, I hate to sound like a complete newb...but hey, when it comes to PHP, I kinda am. -I'm really not trying to be lazy, I'm just confused. Could anyone post some specific scripts for any of this? The most helpful one at this time would be the select box array logic and db query script...I think that is the most complex part of this issue.


muchos gracias!!
joeposter649Connect With a Mentor Commented:
<<I currently have 12 HTML/javascript>>
What server side language?  Just change the form actions to your new php pages.

1). I'd pass the info in URL's to allow the user to bookmark any configuration.
3). If you do it in js then you want to make sure you re-do on the server side so people don't create their own form and submit them with their own prices.
All Courses

From novice to tech pro — start learning today.