Compare commits

...

2 Commits

Author SHA1 Message Date
b703505447 Add m1 2024-08-23 15:24:49 +02:00
671778a8eb test ssh 2024-08-23 14:11:53 +02:00
13 changed files with 283 additions and 11 deletions

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Valutan i kronor</h1>
<?php
$dollar = $_POST['currency'];
$sek = $dollar * 11;
echo "<p>$dollar $ = $sek kr</p>";
?>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>M1-test</title>
</head>
<body>
<form action="./handle.php" method="post">
<fieldset>
<legend>Currency</legend>
<label>Amount in $</label><br>
<input type="text" name="currency">
<input type="submit" value="Convert to SEK">
</fieldset>
</form>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Years to pensoin</title>
</head>
<body>
<h1>Years to pensoin</h1>
<?php
$name = $_POST['name'];
$age = $_POST['age'];
$to_pension = 65 - $age;
echo "<p>$name has $to_pension years to pension";
?>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>M1-test</title>
</head>
<body>
<form action="./handle.php" method="post">
<fieldset>
<legend>Person</legend>
<label>Name</label>
<input type="text" name="name">
<br>
<label>Age</label>
<input type="text" name="age">
<br>
<input type="submit" value="Submit">
</fieldset>
</form>
</body>
</html>

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calculation Result</title>
</head>
<body>
<?php
$n1 = $_POST['n1'];
$n2 = $_POST['n2'];
$sum = $n1 + $n2;
echo "<p>$n1 + $n2 = $sum</p>"
?>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!doctype html>
<html>
<head lang="sv"></head>
<body>
<h1>Matematik-test</h1>
<form action="calculate.php" method="post">
<fieldset>
<legend>Calculator</legend>
<input type="number" name="n1"> +
<input type="number" name="n2">
<br>
<input type="submit" value="Calculate">
</fieldset>
</form>
</body>

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Result</title>
</head>
<body>
<?php
$name = $_GET['name'];
$age = $_GET['age'];
echo "<p>Name - $name; Age - $age</p>"
?>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!doctype html>
<html>
<head lang="sv"></head>
<body>
<h1>Send data via url</h1>
<form action="handle.php" method="get">
<fieldset>
<legend>Person</legend>
<label>Name</label>
<input type="text" name="name">
<label>Age</label>
<input type="number" name="age">
<br>
<input type="submit" value="Submit">
</fieldset>
</form>
</body>

View File

@ -0,0 +1,36 @@
<!doctype html>
<html>
<head lang="sv"></head>
<body>
<h1>Send data via url</h1>
<form action="result.php" method="post">
<fieldset>
<legend>Quizz</legend>
<label>What is the first letter of Alphabet?</label> <br>
<input type="radio" name="q1" value="A">A <br>
<input type="radio" name="q1" value="B">B <br>
<input type="radio" name="q1" value="C">C <br>
<input type="radio" name="q1" value="D">D <br> <br>
<label>What is the second letter of Alphabet?</label> <br>
<input type="radio" name="q2" value="A">A <br>
<input type="radio" name="q2" value="B">B <br>
<input type="radio" name="q2" value="C">C <br>
<input type="radio" name="q2" value="D">D <br> <br>
<label>What is the third letter of Alphabet?</label> <br>
<input type="radio" name="q3" value="A">A <br>
<input type="radio" name="q3" value="B">B <br>
<input type="radio" name="q3" value="C">C <br>
<input type="radio" name="q3" value="D">D <br> <br>
<label>What is the fourth letter of Alphabet?</label> <br>
<input type="radio" name="q4" value="A">A <br>
<input type="radio" name="q4" value="B">B <br>
<input type="radio" name="q4" value="C">C <br>
<input type="radio" name="q4" value="D">D <br> <br>
<input type="submit" value="Submit">
</fieldset>
</form>

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Result</title>
</head>
<body>
<?php
$points = 0;
$q1 = $_POST['q1'];
$q2 = $_POST['q2'];
$q3 = $_POST['q3'];
$q4 = $_POST['q4'];
if($q1 == "A") $points++;
if($q2 == "B") $points++;
if($q3 == "C") $points++;
if($q4 == "D") $points++;
echo "<p>Questions got right = $points</p>"
?>
</body>
</html>

View File

@ -0,0 +1,48 @@
<!doctype html>
<html>
<head lang="sv"></head>
<body>
<h1>Send data via url</h1>
<form action="result.php" method="post">
<fieldset>
<legend>Quizz</legend>
<label>What is the first letter of Alphabet?</label> <br>
<input type="radio" name="q1" value="A">A <br>
<input type="radio" name="q1" value="B">B <br>
<input type="radio" name="q1" value="C">C <br>
<input type="radio" name="q1" value="D">D <br> <br>
<label>What is the second letter of Alphabet?</label> <br>
<input type="radio" name="q2" value="A">A <br>
<input type="radio" name="q2" value="B">B <br>
<input type="radio" name="q2" value="C">C <br>
<input type="radio" name="q2" value="D">D <br> <br>
<label>What is the third letter of Alphabet?</label> <br>
<input type="radio" name="q3" value="A">A <br>
<input type="radio" name="q3" value="B">B <br>
<input type="radio" name="q3" value="C">C <br>
<input type="radio" name="q3" value="D">D <br> <br>
<label>What is the fourth letter of Alphabet?</label> <br>
<input type="radio" name="q4" value="A">A <br>
<input type="radio" name="q4" value="B">B <br>
<input type="radio" name="q4" value="C">C <br>
<input type="radio" name="q4" value="D">D <br> <br>
<label>What is the fifth letter of Alphabet?</label> <br>
<input type="radio" name="q5" value="E">E <br>
<input type="radio" name="q5" value="F">F <br>
<input type="radio" name="q5" value="G">G <br>
<input type="radio" name="q5" value="H">H <br> <br>
<label>What is the sixth letter of Alphabet?</label> <br>
<input type="radio" name="q6" value="E">E <br>
<input type="radio" name="q6" value="F">F <br>
<input type="radio" name="q6" value="G">G <br>
<input type="radio" name="q6" value="H">H <br> <br>
<input type="submit" value="Submit">
</fieldset>
</form>

View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Result</title>
</head>
<body>
<?php
$points = 0;
$q1 = $_POST['q1'];
$q2 = $_POST['q2'];
$q3 = $_POST['q3'];
$q4 = $_POST['q4'];
$q5 = $_POST['q5'];
$q6 = $_POST['q6'];
$result;
if($q1 == "A") $points++;
if($q2 == "B") $points++;
if($q3 == "C") $points++;
if($q4 == "D") $points++;
if($q5 == "E") $points++;
if($q6 == "F") $points++;
if($points >= 5) $result = "Bra, du behärskar det mesta";
else if($points >= 3) $result = "Godkänd";
else $result = "Läs på mer och försök igen";
echo "<p>$result, poäng - $points</p>"
?>
</body>
</html>

View File

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>M1-test</title>
</head>
<body>
<?php echo "Hello world"?>
</body>
</html>