Diff between a407a05ac835c92c1ede4af7dc6598abf3926f77 and d9c756c3ba9ef2befac28c109edff7a3323ae07e

Changed Files

File Additions Deletions Status
index.php +4 -2 modified
lisaa.php +12 -0 added
uusopiskelija.php +64 -0 added

Full Patch

diff --git a/index.php b/index.php
index a08193a..19d775b 100755
--- a/index.php
+++ b/index.php
@@ -13,9 +13,11 @@
       </h1>
       <hr>
       <nav>
-          <a href="/paikat.html">Harjoittelupaikat</a>
+          <a href="index.php">Harjoittelupaikat</a>
           <span>·</span>
-          <a href="/kirjautuminen.html">Kirjaudu sisään</a>
+          <a href="kirjautuminen.html">Kirjaudu sisään</a>
+          <span>·</span>
+          <a href="uusopiskelija.php">Lisää uusi opiskelija</a>
           <hr>
       </nav>
     </header>
diff --git a/lisaa.php b/lisaa.php
new file mode 100644
index 0000000..06be260
--- /dev/null
+++ b/lisaa.php
@@ -0,0 +1,12 @@
+<?php
+include "connect.php";
+
+$sql = "INSERT INTO `oppilaat` (`id`, `nimi`, `paikka`, `ohjaaja`, `yhteystiedot`, `aloitus`, `lopetus`, `status`, `ruokaraha`, `muuta`) VALUES (NULL, '{$_POST["nimi"]}', '{$_POST["paikka"]}', '{$_POST["ohjaaja"]}', '{$_POST["yhteystiedot"]}', '{$_POST["aloitus"]}', '{$_POST["lopetus"]}', '{$_POST["status"]}', '{$_POST["ruokaraha"]}', '{$_POST["muuta"]}')";
+
+if ($conn->query($sql) === TRUE) {
+  echo "New record created successfully";
+} else {
+  echo "Error: " . $sql . "<br>" . $conn->error;
+}
+$conn->close();
+?> 
diff --git a/uusopiskelija.php b/uusopiskelija.php
new file mode 100644
index 0000000..55c17ab
--- /dev/null
+++ b/uusopiskelija.php
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Lisää opiskelija</title>
+    <link rel="stylesheet" type="text/css" href="style.css">
+</head>
+<body>
+    <header>
+      <h1>
+          Lisää opiskelija
+      </h1>
+      <hr>
+      <nav>
+          <a href="index.php">Harjoittelupaikat</a>
+          <span>·</span>
+          <a href="kirjautuminen.html">Kirjaudu sisään</a>
+          <span>·</span>
+          <a href="uusopiskelija.php">Lisää uusi opiskelija</a>
+          <hr>
+      </nav>
+    </header>
+    <main>
+	<section>
+		<form action="lisaa.php" method="POST">
+			<label for="nimi">Nimi:</label>
+			<input type="text" id="nimi" name="nimi" placeholder="Matti Meikäläinen" required>
+			<br>
+			<label for="paikka">Paikka:</label>
+			<input type="text" id="paikka" name="paikka" placeholder="Kpedu">
+			<br>
+			<label for="ohjaaja">Ohjaaja:</label>
+			<input type="text" id="ohjaaja" name="ohjaaja" placeholder="Jaakko Pekka">
+			<br>
+			<label for="yhteystiedot">Yhteystiedot:</label>
+			<input type="text" id="yhteystiedot" name="yhteystiedot" placeholder="0401234 tai jaakko@email.com">
+			<br>
+			<label for="aloitus">Aloitus:</label>
+			<input type="date" id="aloitus" name="aloitus" required>
+			<br>
+			<label for="lopetus">Lopetus:</label>
+			<input type="date" id="lopetus" name="lopetus" required>
+			<br>
+			<label for="status">Status:</label>
+			<input type="text" id="status" name="status" placeholder="Paikkaa etsitään" required>
+			<br>
+			<label for="ruokaraha">Ruokaraha:</label>
+			<input type="text" id="ruokaraha" name="ruokaraha" placeholder="Kyllä">
+			<br>
+			<label for="muuta">Muuta:</label>
+			<input type="text" id="muuta" name="muuta" placeholder="Lähellä bussiasemaa">
+			<br>
+			<input type="submit">
+		</form>
+	</section>
+    </main>
+      <footer>
+        <hr>
+        <p>&copy; Harjoittelupaikat 2025</p>
+        <a href="/index.html#">Takaisin alkuun</a>
+    </footer>
+</body>
+</html>