Finish PHP exercises.
This commit is contained in:
parent
01e65c1fce
commit
70a7b56476
34
2/IAW/assignments/ejercicios-php-naortega/calc-sal.php
Normal file
34
2/IAW/assignments/ejercicios-php-naortega/calc-sal.php
Normal 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>
|
15
2/IAW/assignments/ejercicios-php-naortega/ej2.php
Normal file
15
2/IAW/assignments/ejercicios-php-naortega/ej2.php
Normal 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>
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
Before Width: | Height: | Size: 137 KiB After Width: | Height: | Size: 137 KiB |
Loading…
Reference in New Issue
Block a user