Compare commits

...

2 Commits

Author SHA1 Message Date
3df4a0f590 please 2024-08-23 15:57:59 +02:00
ccd12557eb getting shit done 2024-08-23 15:56:58 +02:00
10 changed files with 247 additions and 21 deletions

View File

@ -0,0 +1,30 @@
<!doctype html>
<html>
<head lang="sv"></head>
<body>
<h1>Matematiktest</h1>
<h2>Resultat</h2>
<?php
$ans1 = $_POST['q1'];
$ans2 = $_POST['q2'];
$ans3 = $_POST['q3'];
$ans4 = $_POST['q4'];
$ans5 = $_POST['q5'];
$points = 0;
$namn = $_POST['namn'];
if($ans1 == 9)
$points++;
if($ans2 == 15)
$points++;
if($ans3 == 3)
$points++;
if($ans4 == 2)
$points++;
if($ans5 == 21)
$points++;
echo("<p>Du fick " . $points . " av 5 möjliga ".$namn."</p>");
include("../footer.html");
?>
</body>
</html>

View File

@ -1,25 +1,34 @@
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8" />
<title>Quiz med Formulär och PHP</title>
</head>
<!doctype html>
<html>
<head lang="sv"></head>
<body>
<h1>Quiz</h1>
<form action="result.php" method="post">
<label>I vilket språk programmerar vi i kursen?<br>
<input type="radio" name="qOne" value="php">PHP<br>
<input type="radio" name="qOne" value="asp">ASP<br>
<input type="radio" name="qOne" value="jsp">JSP<br><br>
</label>
<label>Vilket språk är ett klientskriptspråk<br>
<input type="radio" name="qTwo" value="jsp">JSP<br>
<input type="radio" name="qTwo" value="js">JavaScript<br>
<input type="radio" name="qTwo" value="basic">Basic<br><br>
</label>
<input type="submit" value="Skicka" />
<a href="result.php?id=21&name=kalle&age=13">Nästa</a>
<h1>Matematik-test</h1>
<form action="evaluate.php" method="post">
<fieldset>
<legend>Frågor</legend>
<label>4 + 5 = </label>
<input type="text" name="q1">
<br>
<label>3 x 5 = </label>
<input type="text" name="q2">
<br>
<label>5 - 2 = </label>
<input type="text" name="q3">
<br>
<label>6/3 = </label>
<input type="text" name="q4">
<br>
<label>15 + 6 = </label>
<input type="text" name="q5">
<br>
<label>Namn</label>
<input type="text" name="namn">
<br>
<input type="submit" value="Rätta">
</fieldset>
</form>
<?php
include("../footer.html");
?>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="utf-8">
<title>Valuta</title>
</head>
<body>
<h1>Valutan i kronor</h1>
<?php
$dollar = $_POST['currency'];
$sek = $dollar * 9.7;
echo "<p>$dollar $ = $sek kr</p>";
include("../footer.html");
?>
</body>
</html>

View File

@ -0,0 +1,69 @@
<!doctype html>
<html>
<head lang="sv"></head>
<body>
<h1>Matematik-test</h1>
<form action="currency.php" method="post">
<fieldset>
<legend>Valutakonverterare</legend>
<label>Ange ett belopp i dollar</label>
<input type="text" name="currency">
<input type="submit" value="Rätta">
</fieldset>
</form>
<form action="persondata.php" method="post">
<fieldset>
<legend>Persondata</legend>
<label>Skriv in namn</label>
<input type="text" name="namn">
<label>Skriv in ålder</label>
<input type="text" name="ålder">
<input type="submit" value="Rätta">
</fieldset>
</form>
<form action="kalkylator.php" method="post">
<fieldset>
<legend>Kalkylator</legend>
<input type="number" name="n1"> +
<input type="number" name="n2">
<br>
<input type="submit" value="Beräkna">
</fieldset>
</form>
<form action="persondata2.php" method="get">
<fieldset>
<legend>Persondata</legend>
<label>Skriv in namn</label>
<input type="text" name="namn">
<label>Skriv ditt födelseår</label>
<input type="text" name="födelseår">
<input type="submit" value="Rätta">
</fieldset>
</form>
<form action="quiz.php" method="post">
<fieldset>
<legend>Quiz</legend>
<label>Vad är den 10:n siffran?</label>
<input type="text" name="q1">
<label>Vad är den 11:n siffran?</label>
<input type="text" name="q2">
<label>Vad är den 12:n siffran?</label>
<input type="text" name="q3">
<label>Vad är den 13:n siffran?</label>
<input type="text" name="q4">
<label>Vad är den 14:n siffran?</label>
<input type="text" name="q5">
<label>Vad är den 15:n siffran?</label>
<input type="text" name="q6">
<input type="submit" value="Rätta">
</fieldset>
</form>
<?php
include("../footer.html");
?>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="utf-8">
<title>Kalkylator</title>
</head>
<body>
<h1>Kalkylator</h1>
<?php
$n1 = $_POST['n1'];
$n2 = $_POST['n2'];
$summa = $n1 + $n2;
echo "<p>Summan av ".$n1." och ".$n2." är ".$summa."</p>";
include("../footer.html");
?>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="utf-8">
<title>Persondata</title>
</head>
<body>
<h1>År till pension</h1>
<?php
$namn = $_POST['namn'];
$ålder = $_POST['ålder'];
$pensionsålder = 65 - $ålder;
echo "<p>Du heter ".$namn." och har ".$pensionsålder." år till pension</p>";
include("../footer.html");
?>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="utf-8">
<title>Persondata2</title>
</head>
<body>
<h1>Födelseår</h1>
<?php
$namn = $_GET['namn'];
$födelseår = $_GET['födelseår'];
echo "<p>Du heter ".$namn." och var född ".$födelseår."</p>";
include("../footer.html");
?>
</body>
</html>

View File

@ -0,0 +1,41 @@
<!doctype html>
<html>
<head lang="sv"></head>
<body>
<h1>Matematiktest</h1>
<h2>Resultat</h2>
<?php
$ans1 = $_POST['q1'];
$ans2 = $_POST['q2'];
$ans3 = $_POST['q3'];
$ans4 = $_POST['q4'];
$ans5 = $_POST['q5'];
$ans5 = $_POST['q5'];
$points = 0;
if($ans1 == 10)
$points++;
if($ans2 == 11)
$points++;
if($ans3 == 12)
$points++;
if($ans4 == 13)
$points++;
if($ans5 == 14)
$points++;
if($ans5 == 15)
$points++;
echo("<p>Du fick " . $points . " av 6 möjliga</p>");
if($points >= 5) {
echo("<p>Bra, du behärskar det mesta</p>");
}
else if($points >= 3) {
echo("<p>Godkänd</p>");
}
else {
echo("<p>Läs på mer och försök igen</p>");
}
include("../footer.html");
?>
</body>
</html>

3
www/public/footer.html Normal file
View File

@ -0,0 +1,3 @@
<footer>
<a href="../index.php">Tillbaka</a>
</footer>

View File

@ -7,5 +7,6 @@
</head>
<body>
<a href="Moment-0/index.php">Moment-0</a>
<a href="Moment-1/index.php">Moment-1</a>
</body>
</html>