Mini Kabibi Habibi

Current Path : C:/xampp/htdocs/Website/includes/
Upload File :
Current File : C:/xampp/htdocs/Website/includes/formhandler.inc.php

<?php

if ($_SERVER["REQUEST_METHOD"] == "POST") {	
	$username = $_POST["username"];
	$pwd = $_POST["pwd"];
	$email = $_POST["email"];

	try {
		require_once "dbh.inc.php";

		$query = "INSERT INTO users (username, pwd, email) VALUES (?, ?, ?)";

		$stmt = $pdo->prepare($query);

		$stmt->execute([$username, $pwd, $email]);

		$pdo = null;
		$stms = null;

		header("Location: ../index.php");

		die();
	} catch (PDOException $e) {
		die("Query failed: " . $e->getMessage());
	}
} else {
	header("Location: ../index.php");
}