Finish PHP exercises.

This commit is contained in:
Nicolás A. Ortega Froysa 2022-11-11 17:46:42 +01:00
parent 01e65c1fce
commit 70a7b56476
7 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>Calculate Salary</title>
</head>
<body>
<?php
$name = $_POST["name"];
$sirname = $_POST["sirname"];
$salary = $_POST["salary"];
$age = $_POST["age"];
if($salary > 1000 && $salary <= 2000) {
if($age > 45)
$salary *= 1.03;
else
$salary *= 1.1;
} else if($salary <= 1000){
if($age < 30)
$salary = 1100;
else if($age <= 45)
$salary *= 1.03;
else
$salary *= 1.15;
}
?>
Name: <?= $name ?><br />
Sirname: <?= $sirname ?><br />
Salary: <?= $salary ?>€<br />
Age: <?= $age ?><br />
</body>
</html>

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Calculate Salary</title>
</head>
<body>
<form action="calc-sal.php" method="POST" >
Name: <input type="text" name="name" /><br />
Sirname: <input type="text" name="sirname" /><br />
Salary: <input type="number" name="salary" /><br />
Age: <input type="number" name="age" /><br />
<input type="submit" />
</form>
</body>
</html>

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 121 KiB

View File

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 137 KiB