Customer Registration

setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $db->prepare("INSERT INTO customers (name, mobile, email) VALUES (:name, :mobile, :email)"); $stmt->bindParam(':name', $_POST['name']); $stmt->bindParam(':mobile', $_POST['mobile']); $stmt->bindParam(':email', $_POST['email']); if ($stmt->execute()) { echo '
New Customer ' . htmlspecialchars($_POST['name']) . ' created successfully.
'; } else { echo '
Error executing statement: ' . $stmt->errorInfo()[2] . '
'; } } catch (PDOException $e) { echo '
Error: ' . $e->getMessage() . '
'; } } ?>