setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $name = $_POST['name']; $email = $_POST['email']; $password = $_POST['password']; $number = $_POST['number']; $hashed_password = password_hash($password, PASSWORD_DEFAULT); $stmt = $conn->prepare("INSERT INTO users (name, email, password, number, uid) VALUES (:name, :email, :password, :number, :uid)"); $stmt->bindParam(':name', $name); $stmt->bindParam(':email', $email); $stmt->bindParam(':password', $hashed_password); $stmt->bindParam(':number', $number); $stmt->bindParam(':uid', $uid); if ($stmt->execute()) { header("Location: login.php"); exit(); } else { // Something went wrong echo "Error registering user."; } } catch(PDOException $e) { echo "Connection failed: " . $e->getMessage(); } ?>