prepare("SELECT id FROM users WHERE email = ?"); $stmt->execute([$email]); if ($stmt->fetch()) { $errors[] = "An account with this email already exists."; } else { $hashed_password = password_hash($password, PASSWORD_DEFAULT); $stmt = $pdo->prepare("INSERT INTO users (name, email, password) VALUES (?, ?, ?)"); if ($stmt->execute([$name, $email, $hashed_password])) { header("Location: login.php"); exit; } else { $errors[] = "Something went wrong. Please try again later."; } } } catch (PDOException $e) { $errors[] = "Database error: " . $e->getMessage(); } } } ?>

Create Your Account

Already have an account? Log In