prepare($sql); $stmt->execute([$client_id, $name, $email, $phone, $role]); header("Location: contacts.php?success=1"); exit(); } catch (PDOException $e) { header("Location: contacts.php?error=" . urlencode($e->getMessage())); exit(); } } else { header("Location: contacts.php?error=invalid_input"); exit(); } } ?>