php-school/prestito/prestito.php
2024-10-31 10:47:12 +01:00

39 lines
No EOL
961 B
PHP

<?php
session_start();
if (!isset($_POST["prestito"]) or ($_POST["cifra"] == "")) {
header("Location: errore.php");
exit();
}
$_SESSION["nome"] = $_POST["nome"];
$_SESSION["cognome"] = $_POST["cogn"];
$_SESSION["prestito"] = $_POST["prestito"];
$_SESSION["cifra"] = $_POST["cifra"];
if ($_POST["prestito"] == 12) {
$temp = $_POST["cifra"] * 1.04;
} else {
$temp = $_POST["cifra"] * 1.004167;
}
$_SESSION["cifraCalcolata"] = $temp;
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Prestito</title>
<?php require "includes/head.php" ?>
</head>
<body>
<h1>Calcolo saldo del prestito richiesto</h1>
<p>Benvenuto <?php echo $_POST["nome"] . " " . $_POST["cogn"]; ?><br>
il saldo del tuo prestito di <?php echo $_POST["cifra"] ?> tra xx giorni sarà di:
<?= $_SESSION["cifraCalcolata"] ?> &euro;
</p>
<a class="btn btn-primary" href="conferma.php" role="button">Conferma Prestito</a>
<?php require "includes/footer.php" ?>
</body>
</html>