php:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="./stan_rzek.css">
</head>
<body>
<?php
$link = mysqli_connect("localhost","root","","jaka_stolica");
$q = mysqli_query($link,"SELECT * FROM stolica");
?>
<div id="container">
<div id="header_lewy">
<h1>Stolice Państw Europy</h1>
</div>
<div id="header_prawy">
<img src="./europa.png" alt="mapa Europy">
</div>
<div id="content">
<form method="post">
<?php
$punkty = 0;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
?>
<div id="submit"><input type="submit" value="wynik testu"></div>
</form>
</div>
<div id="wynik">
<?php
echo "ilość punktów: ",$punkty,"/8";
$pr = $punkty/8*100;
echo " ocena: ";
if($pr<50) echo "niedostateczny: $pr%";
if($pr>=50 and $pr<70) echo "dopuszczający: $pr%";
if($pr>=70 and $pr<80) echo "dostateczny: $pr%";
if($pr>=80 and $pr<90) echo "dobry: $pr%";
if($pr>=90) echo "bardzo dobry: $pr%";
?>
</div>
<div id="footer">Zespół Szkół w Działoszynie im. Marii Skłodowskiej-Curie</div>
</div>
</body>
</html>
css:
#header_lewy,#header_prawy {
background-color: gray;
color: whitesmoke;
font-size: x-large;
width: 70%;
float: left;
height: 100px;
text-align: center;
margin-bottom: 10px;
}
#header_prawy {
display: flex;
align-items: center;
width: 30%;
border-radius: 0 20px 20px 0;
}
#header_lewy {
border-radius: 20px 0 0 20px;
display: flex;
justify-content: center;
align-items: center;
}
img {
width: 100px;
border-radius: 20px;
opacity: 0.1;
}
fieldset {
width: 150px;
float: left;
margin: 1% 2%;
z-index: 1;
}
#submit {
clear: both;
margin-left:5%;
padding-top:2%;
}
#content {
background-color: rgb(195, 190, 190);
clear: both;
padding: 20px 0;
border-radius: 20px;
margin-bottom: 10px;
}
#footer {
background-color: gray;
text-align: center;
padding:5px;
border-radius: 20px;
color: bisque;
}
#submit input {
border-radius: 20px;
padding:5px;
}
fieldset {
border-radius: 10px;
}
legend {
font-weight: bold;
}
#wynik {
color: #222;
padding: 6px;
font-weight: bold;
margin-left: 5%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="./stan_rzek.css">
</head>
<body>
<?php
$link = mysqli_connect("localhost","root","","jaka_stolica");
$q = mysqli_query($link,"SELECT * FROM stolica");
?>
<div id="container">
<div id="header_lewy">
<h1>Stolice Państw Europy</h1>
</div>
<div id="header_prawy">
<img src="./europa.png" alt="mapa Europy">
</div>
<div id="content">
<form method="post">
<?php
$punkty = 0;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
echo"<fieldset>";
$row = mysqli_fetch_row($q);
echo "<legend>$row[1]</legend>";
for($i=2;$i<=5;$i++)
echo "<input type='radio' name='$row[1]' value='$row[$i]'>$row[$i] <br>";
echo "</fieldset>";
if(@$_POST["$row[1]"]==$row[6]) $punkty++;
?>
<div id="submit"><input type="submit" value="wynik testu"></div>
</form>
</div>
<div id="wynik">
<?php
echo "ilość punktów: ",$punkty,"/8";
$pr = $punkty/8*100;
echo " ocena: ";
if($pr<50) echo "niedostateczny: $pr%";
if($pr>=50 and $pr<70) echo "dopuszczający: $pr%";
if($pr>=70 and $pr<80) echo "dostateczny: $pr%";
if($pr>=80 and $pr<90) echo "dobry: $pr%";
if($pr>=90) echo "bardzo dobry: $pr%";
?>
</div>
<div id="footer">Zespół Szkół w Działoszynie im. Marii Skłodowskiej-Curie</div>
</div>
</body>
</html>
css:
#header_lewy,#header_prawy {
background-color: gray;
color: whitesmoke;
font-size: x-large;
width: 70%;
float: left;
height: 100px;
text-align: center;
margin-bottom: 10px;
}
#header_prawy {
display: flex;
align-items: center;
width: 30%;
border-radius: 0 20px 20px 0;
}
#header_lewy {
border-radius: 20px 0 0 20px;
display: flex;
justify-content: center;
align-items: center;
}
img {
width: 100px;
border-radius: 20px;
opacity: 0.1;
}
fieldset {
width: 150px;
float: left;
margin: 1% 2%;
z-index: 1;
}
#submit {
clear: both;
margin-left:5%;
padding-top:2%;
}
#content {
background-color: rgb(195, 190, 190);
clear: both;
padding: 20px 0;
border-radius: 20px;
margin-bottom: 10px;
}
#footer {
background-color: gray;
text-align: center;
padding:5px;
border-radius: 20px;
color: bisque;
}
#submit input {
border-radius: 20px;
padding:5px;
}
fieldset {
border-radius: 10px;
}
legend {
font-weight: bold;
}
#wynik {
color: #222;
padding: 6px;
font-weight: bold;
margin-left: 5%;
}