hi all,
i have a question, i don't know it is difficult, but if you're a little bit expierenced, keep reading anyway
i'm making a webshop for our school, and i want to have an automatic price calculator on product select & amount-fill-in.
code:
<div id="select1" >
<select name="productadd" onChange="document.getElementById('select2').style.display=(this.options.selectedIndex>0?'block' : 'none');"
>
<option value="" selected="selected">maak uw keuze</option>
<?php $lendetta = mysql_query("SELECT * FROM `forum_shopproduct` WHERE `actief`=1");
while ($gegeven = mysql_fetch_array($lendetta)) {
$naam = $gegeven["naam"];
$id = $gegeven["id"];
echo "<option value='".$id."'>".$naam."</option>";
}
?></select><input type="text" height="1" size="20" name="aantaladd1" value="0">
<span id="prijs1"></span><br></div>
in <span id="prijs1"></span>, there has to come a price.
the price has to be calculated like this:
code:
$query = mysql_query("SELECT * FROM `forum_shopproduct` WHERE `code`='(the value of the select-menu specified in the while)'");
$dbres = mysql_fetch_object($query);
$prijs = $dbres->prijs;
i think this is it, so the script (in js) has to determine the price live.. maybe use an array with prices or something, but you're the experienced one, not me!