<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" c initial-scale=1.0">
<title>Document</title>
<style>
table,td{
border: solid 1px red;
}
</style>
</head>
<body>
<h2>Dodaj Ucznia</h2>
<form acti method="post">
imie: <input type="text" name="imie"><br>
nazwisko: <input type="text" name="nazw"><br>
id klasy: <input type="number" name="klasa"><br>
<input type="submit" name="wyslij" value="zapisz"><br>
</form>
<h2>Dodaj klasę</h2>
<form acti method="get">
nazwa klasy: <input type="text" name="nazwa"><br>
wychowawca: <input type="text" name="wych"><br>
<input type="submit" name="send" value="zapisz"><br>
</form>
<?php
if (isset($_GET['send'])) {
$conn=mysqli_connect('localhost','root','','szkola');
$q2="INSERT INTO `klasy`(`nazwa_klasy`, `wychowawca`) VALUES ('$_GET[nazwa]','$_GET[wych]')";
mysqli_query($conn,$q2);
mysqli_close($conn);
}
if (isset($_POST['wyslij'])) {
$conn=mysqli_connect('localhost','root','','szkola');
$q1="INSERT INTO `uczniowie`(`imie`, `nazwisko`, `id_klasy`) VALUES('$_POST[imie]','$_POST[nazw]',$_POST[klasa])";
mysqli_query($conn,$q1);
mysqli_close($conn);
}
$conn=mysqli_connect('localhost','root','','szkola');
$q="SELECT uczniowie.`imie`, uczniowie.`nazwisko`, `klasy`.`nazwa_klasy`, klasy.`wychowawca` FROM `uczniowie` JOIN klasy ON `uczniowie`.`id_klasy`=`klasy`.`id_klasy`;";
$wynik=mysqli_query($conn,$q);
echo"<table>";
while ($a=mysqli_fetch_array($wynik)) {
echo"<tr><td>$a[0]</td><td>$a[1]</td><td>$a[2]</td><td>$a[3]</td></tr>";
}
echo"</table>";
mysqli_close($conn);
?>
</body>
</html>
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}