JavaScript
4
Вклад в тег
const button = document.getElementById('button');
const button = document.querySelector('#button');
button.addEventListener('click', function (e){
console.log(i);
});
button.addEventListener('click', (event) => {
console.log(i);
});
$db = new PDO('mysql:host=...;dbname=...', $user, $pass);
if ( !isset($_POST['name']) || !isset($_POST['lastname']) || !isset($_POST['email']) || !isset($_POST['pass']) ) {
echo 'Не все данные заполнены!!!';
die;
}
$name = $_POST['name'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$pass = $_POST['pass'];
$stmt = $dbh->prepare("INSERT INTO REGISTRY (name, lastname, email, password) VALUES (:name, :lastname, :email, :password)");
$stmt->bindParam(':name', $name);
$stmt->bindParam(':lastname', $lastname);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':password', $password);
$falg = $stmt->execute();
if ($flag) {
echo 'Успешно';
die;
} else {
echo 'Ошибка';
die;
}
Как с этим работать?