PHP is a server side language so you would use it to replace hard coded
<OPTION value = Blue>Blue</OPTION>
<OPTION value = Green>Green</OPTION>
<OPTION value = Black>Black</OPTION>
with colours from a database query or some other source. The HTML page
you generate doesn't care if it was hard coded or built on the fly by
PSP / ASP or anything else.
As for changing the prices would be to either embed the price in the
code somewhere
<OPTION value = Blue(14.99)>Blue</OPTIONor as a hidden field on the
form, containing an array of the data you need...
and use javascript to change a form field value client side, or to
resubmit the page and find the correct price for the item added.
Personally I'd resubmit coz lots of people have JS turned off and
otherwise they would be able to see the data in its raw form.
Aaron
Flic wrote:
Hi, I currently have a website that uses an option drop down box to
select different colours for an item before the form it is in is
submitted.
This works fine but as I am trying to advance my skills I decided to
learn PHP to use with SQL which I already know. I have yet to start but
am thinking of how to go about it and looking at some example code. The
whole thing looks easier enough but I was wondering how these option
boxs would fit into it.
I'm thinking one way to possibly do it would be an array with all the
options in. However, would it be possible to have what should be the
contents of the array as part of the table? For eg something like:
Colours
-----------
Blue,black,green
And also would it be possible using these to change the price of an
item? That isn't so important now but may be useful in the future,
although I can make it work another way if need be.
Any help much appreciated!
Thanks
Flic