Compare commits
2 Commits
3e28c02ccb
...
3df4a0f590
Author | SHA1 | Date | |
---|---|---|---|
3df4a0f590 | |||
ccd12557eb |
30
www/public/Moment-0/evaluate.php
Normal file
30
www/public/Moment-0/evaluate.php
Normal 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>
|
@ -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 på 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>
|
18
www/public/Moment-1/currency.php
Normal file
18
www/public/Moment-1/currency.php
Normal 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>
|
||||
|
69
www/public/Moment-1/index.php
Normal file
69
www/public/Moment-1/index.php
Normal 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>
|
19
www/public/Moment-1/kalkylator.php
Normal file
19
www/public/Moment-1/kalkylator.php
Normal 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>
|
19
www/public/Moment-1/persondata.php
Normal file
19
www/public/Moment-1/persondata.php
Normal 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>
|
17
www/public/Moment-1/persondata2.php
Normal file
17
www/public/Moment-1/persondata2.php
Normal 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>
|
41
www/public/Moment-1/quiz.php
Normal file
41
www/public/Moment-1/quiz.php
Normal 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
3
www/public/footer.html
Normal file
@ -0,0 +1,3 @@
|
||||
<footer>
|
||||
<a href="../index.php">Tillbaka</a>
|
||||
</footer>
|
@ -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>
|
Loading…
Reference in New Issue
Block a user