I've created a form in html. in this form you can specify the operating system. The form looks like this:
<input type="hidden" name="toshibaproduct" value="001"/>
<input type="hidden" name="toshibamerk" value="toshiba"/>
<input type="hidden" name="toshibamodel" value="Sattelite A100-510"/>
Operating system <select name="beschikbaarheid" value="true">
<option value="xp">Windows XP</option>
<option value="vista">Windows Vista</option>
<option value="linux">Linux</option>
</select>
Aantal: <input type="text" size=2 maxlength=3 name="toshibaaantal" value="0"/>
<input type="hidden" name="toshibaprijs" value="999.99"/>
<input type="image" src="bestel.jpg" border=0 value="bestellen"/>
I've also created an external function which i have included in the page which looks like this:
<?php
function beschikbaarheid($merk, $os)
{
$beschikbaar = array(
"Toshiba" => array("xp" => true, "vista" => false, "linux" => true),
"Acer" => array("xp" => true, "vista" => true, "linux" => true),
"Hp" => array("xp" => true, "vista" => false, "linux" => true));
return ($beschikbaar[$merk][$os]);
}
?>
My plan is to let the form check in the external function if an operating system is available or not, and if not return a message that it's sold out. if it's available it should just continue with the rest of the script (which works btw, but it not included here).
Thing is, i don't know how to make the form check the array in the external function. I am also wondering if it's a problem that only the operatings system is checked in an external function and not the rest of the form like the quantity for instance.