Forum Moderators: open
I'm starting a computer business and would like to add a script to my website that would allow customers to custom build their computers piece by piece. Having Radio Buttons to select choices for hard drives, monitors, ect. and display the price and update it instantly.
So say, they want a 1TB Hard-Drive instead of the 500GB one, they can click the radio button for the 1TB HardDrive and it'll change the price instantly.
How would I go about doing this?
So, your saying, store them in a Database or such, and pull the data from that?
How would I update the total price instantly? How would I get the prices to be added together. Sorry if I'm not making sense, I'm trying to explain it as best as I could. Maybe if I show an example it'll help give an idea of what I'm trying to do.
<input name="memory" type="button" value="25">1GB<br>
<input name="memory" type="button" value="50">2GB<br>
<input name="memory" type="button" value="75">3GB<br>
Once it's done, NOW take what you've learned and build your javascript to do it all on one page.
Three advantages:
- Your site will work with and without Javascript. This is a Really Big Deal.
- Your site will have no "holes" if Javascript is disabled, you won't get orders for a $50 computer because JS didn't do the calculation for you.
- When it's all working, all you need to do is duplicate the server-side functions in JS, it will make programming the JS much easier - and - you will already KNOW what values you'll need to store in the page, and have the server-side scripting in place to make it happen. Example, someone pulls up X brand of motherboard, you query the DB for all the options for brand X, store those in the JS so you don't need to hard code everything.
I've found it much harder to debug something that started with JS and added the backend than the other way around.