Codice PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> editor
</title>
</head>
<body bgcolor="#FFFFFF" style="margin:5px;">
<form action="index.php" method="post">
Giorno :
<input type="text" name="giorno" maxlength="2" size=2>
Mese :
<input type="text" name="mese" maxlength="2" size=2>
Anno :
<input type="text" name="anno" maxlength="2" size=2>
<input type="submit" value="Calcola">
</form>
<?php
if (array_key_exists("giorno",$_POST) && array_key_exists("mese",$_POST) && array_key_exists("anno",$_POST)):
if ($_POST["giorno"] && $_POST["mese"] && $_POST["anno"]):
$_POST["giorno"]=sprintf("%02d",$_POST["giorno"]);
$_POST["mese"]=sprintf("%02d",$_POST["mese"]);
$_POST["anno"]=sprintf("%02d",$_POST["anno"]);
$calc = (intval($_POST["giorno"][0]) * intval($_POST["giorno"][1])) + (intval($_POST["mese"][0]) * intval($_POST["mese"][1])) + (intval($_POST["anno"][0]) * intval($_POST["anno"][1]));
echo "IL TUO NUMERO FORTUNATO È ".$calc;
endif;
endif;
?>
</body>
</html>
Ciao!