salve a tutti:
la funzione dovrebbe cliccando sul pulsante go dare il risultato dei checkbox a seconda di quelli che sonpo checked o meno
Codice PHP:
$win="";
$lin="";
$winlin="";
$tot="";
function Host($tot)
{
global $win,$lin,$winlin,$tot;
if ($win)
{
//$win=30;
$tot=30+$lin+$winlin;
}
else
{
$win=0;
}
if($lin)
{
//$lin=30;
$tot=$win+30+$winlin;
}
else
{
$lin=0;
}
if($winlin)
{
//$winlin=45;
//$tot2=$tot1+$winlin;
$tot=$win+$lin+45;
}
else
{
$winlin=0;
}
print $tot;
}
echo "<center><table><tr>
<td><input name=\"hosting\" type=\"checkbox\" value=$win >Win</td><td>30 €</td></tr>
<tr><td><input name=\"hosting2\" type=\"checkbox\" value=$lin >Linux</td><td>30 €</td></tr>
<tr><td><input name=\"hosting3\" type=\"checkbox\" value=$winlin >Win+Linux</td><td>45 €</td></tr></table>
</center>
<input type=button value=go onclick=Host($tot);>
";
grazie in anticipo