Forum Moderators: open

Message Too Old, No Replies

Javascript / data from mySQL Database / PHP

Javascript Function for data retrieved from mySQL Database with PHP

         

Moritz

10:15 am on May 27, 2004 (gmt 0)

10+ Year Member



We have a drop down menu that calls in product prices from a mySQL database through a PHP loop. Through a Javascript function, the prices are added up with the onChange event handler. This works fine in Netscape, Safari etc., but not at all in Internet Explorer. In Explorer, the Javascript doesn't recognise the "value" selected in the drop down menu, even though the page as it appears in the end-user's browser clearly shows the values retrieved from the database between the <option> tags of the <select> menu.

Is anyone familiar with this problem or more importantly with a solution?

Thank you very much,
Moritz Gaede
Anne Schlotz

Birdman

10:38 am on May 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How is your script accessing the value of the dropdown? That's the key. Is it using onchange="somefunction(this.value)" or some other way?

Moritz

10:57 am on May 27, 2004 (gmt 0)

10+ Year Member



The script is accessing the value of the dropdown through onChange="subtotal()" in the <select> tag. The function is defined as follows:

<script language="JavaScript" type="text/javascript">
<!--
function subtotal() {

var base_price = parseInt(document.form1.price1.value);
var add_price = parseInt(document.form1.gcard.value);

var sub_total = base_price + add_price;

document.grafikkarten.total.value = sub_total;

}
//-->
</script>

Thank you for your help!
:-)