Esecizi in php su moduli
This commit is contained in:
82
php_6.php
Normal file
82
php_6.php
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
<?php
|
||||
|
||||
require_once ('functions.php');
|
||||
include('header.html');
|
||||
|
||||
///////////////////////////
|
||||
echo<<<_css
|
||||
|
||||
<style>
|
||||
|
||||
input.prezzo {
|
||||
border: 0px solid;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
table, td {
|
||||
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
</style>
|
||||
_css;
|
||||
echo "\n";
|
||||
///////////////////////////
|
||||
|
||||
|
||||
if ($_GET == null){
|
||||
|
||||
|
||||
echo<<<_html
|
||||
|
||||
|
||||
<form method="get" >
|
||||
|
||||
Primo<input type="checkbox" name="primo" value="Primo"/> Prezzo: <input class="prezzo" type="text" name="primo_prezzo" value="100" size ="1" readonly> euro <br>
|
||||
Secondo<input type="checkbox" name="secondo" value="Secondo"/> Prezzo: <input class="prezzo" type="text" name="secondo_prezzo" value="45" size ="1" readonly> euro <br>
|
||||
Frutta<input type="checkbox" name="frutta" value="Frutta"/> Prezzo: <input class="prezzo" type="text" name="frutta_prezzo" value="10" size ="1" readonly> euro <br>
|
||||
Costo servizio: <input class="prezzo" type="text" name="servizio_prezzo" value="1" size ="1" readonly> euro <br>
|
||||
<input type="submit" value="Invia">
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
_html;
|
||||
|
||||
}else {
|
||||
|
||||
$totale = 0;
|
||||
echo "<table>";
|
||||
|
||||
echo "<tr><td colspan=\"2\"> Costo Servizio " . $_GET['servizio_prezzo'] . "</td></tr>\n"; $totale+=$_GET['servizio_prezzo'];
|
||||
|
||||
if (array_key_exists("primo", $_GET)) { echo "<tr><td> Primo </td><td>" . $_GET['primo_prezzo'] . "</td></tr>\n";$totale+=$_GET['primo_prezzo'];}
|
||||
if (array_key_exists("secondo", $_GET)) { echo "<tr><td> Secondo </td><td>" . $_GET['secondo_prezzo'] . "</td></tr>\n";$totale+=$_GET['secondo_prezzo'];}
|
||||
if (array_key_exists("frutta", $_GET)) { echo "<tr><td> Frutta </td><td>" . $_GET['frutta_prezzo'] . "</td></tr>\n";$totale+=$_GET['frutta_prezzo'];}
|
||||
|
||||
echo "<tr><td colspan=\"2\"> Totale " . $totale . "</td></tr>\n";
|
||||
|
||||
|
||||
|
||||
echo "</table>";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
include ('footer.html');
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user