brianilland
08-12-2004, 04:49 AM
Hi all,
Finally got a bit of javascript working, which works out a quick and dirty client side online quote. Now, the whole javascript works based on the value of a dropdown within Option tags. The way Ive done it I've hardcoded it below :
value="Product/Size/Price"
eg. value="My Product/3.14/35.60"
Now, ideally what I would like to do is to remove all the hardcoded references to product/size/price and add load them from a mySQL database on the server using PHP. My site is a mambo/php one, so I can create a database ok with the details using phpmyAdmin.
Does anyone have any examples of code where this is done - i.e - where PHP reads in values from a database to populate as variables within a javascript.
OK, maybe that's more of a php question - more on the topic of javascript, can you tell me how I can at least populate the 'value=' with a variable, so I could define
dropdown1value = "My Product/3.14/35.60"
in the header section, and then
value=dropdownvalue1;
in the form option tags.......I tried using document.write but I think it doesn't like the '/'....?
Thanks in advance....
Finally got a bit of javascript working, which works out a quick and dirty client side online quote. Now, the whole javascript works based on the value of a dropdown within Option tags. The way Ive done it I've hardcoded it below :
value="Product/Size/Price"
eg. value="My Product/3.14/35.60"
Now, ideally what I would like to do is to remove all the hardcoded references to product/size/price and add load them from a mySQL database on the server using PHP. My site is a mambo/php one, so I can create a database ok with the details using phpmyAdmin.
Does anyone have any examples of code where this is done - i.e - where PHP reads in values from a database to populate as variables within a javascript.
OK, maybe that's more of a php question - more on the topic of javascript, can you tell me how I can at least populate the 'value=' with a variable, so I could define
dropdown1value = "My Product/3.14/35.60"
in the header section, and then
value=dropdownvalue1;
in the form option tags.......I tried using document.write but I think it doesn't like the '/'....?
Thanks in advance....