ok jeg smider php filen ind her så:
<?php
// Tilføre Header.php her
include 'c:/wamp64/www/fesmanager/includes/header.php';
// Databaseforbindelsen her
include 'c:/wamp64/www/fesmanager/includes/database.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="
http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Opret Bruger.</title>
</head>
<body>
<p align="center">Opret Bruger. </p>
<br />
<form action="create_user.php" method="POST">
<div align="center">Brugernavn.:
<input type="text" name="username" placeholder="Brugernavn" required>
<br>
Adgangskode:
<input type="password" name="password" placeholder="Adgangskode" required>
<br>
Navn:
<input type="text" name="first_name" placeholder="Fornavn" required>
<br>
Efternavn:
<input type="text" name="last_name" placeholder="Efternavn" required>
<br>
E-Mail:
<input type="email" name="email" placeholder="Email" required>
<br>
Mobil:
<input type="text" name="mobile" placeholder="Mobil" required>
<br>
Stabsnavn:
<input type="text" name="staff_name" placeholder="Stabsnavn" required>
<br>
<input type="submit" value="Opret bruger">
</div>
</form>
</body>
</html>
<?php
// Henter form data og undgår SQL Injection
$username = $_POST["username"];
$password = $conn->real_escape_string($_POST['password']);
$first_name = $conn->real_escape_string($_POST['first_name']);
$last_name = $conn->real_escape_string($_POST['last_name']);
$email = $conn->real_escape_string($_POST['email']);
$mobile = $conn->real_escape_string($_POST['mobile']);
$staff_name = $conn->real_escape_string($_POST['staff_name']);
// Indsætter bruger i databasen
$sql = "INSERT INTO Users (username, password, first_name, last_name, email, mobile, staff_name)
VALUES ('$username', '$password', '$first_name', '$last_name', '$email', '$mobile', '$staff_name')";
if ($conn->query($sql) === TRUE) {
echo "Bruger oprettet succesfuldt.";
} else {
echo "Fejl: " . $sql . "<br>" . $conn->error;
}
// Lukker databaseforbindelsen
$conn->close();
?>
Jeg håber det måske kan hjælpe.