Answer the question
In order to leave comments, you need to log in
Why is INSERT INTO not adding data to phpmyadmin?
Hello)
There is a handler that collects data from forms:
<?php
header('Content-Type: text/html; charset=utf-8');
include_once("database.php"); //это подключение к базе через отдельный пхп
if(isset($_POST['add'])) //если нажали на кнопку, но выполнится скрипт ниже
{
$product = '300';
$name = strip_tags(trim($_POST['name']));
$age = strip_tags(trim($_POST['age']));
$url = strip_tags(trim($_POST['url']));
$mail = strip_tags(trim($_POST['mail']));
$check = '';
if (!empty($_V["check"]) && is_array($_POST["check"]))
{$check = implode(" ", $_POST["check"]);
}; // сохраняем в переменную данные полученные из чекбоксов
$result = mysql_query("
INSERT INTO `zakaz` (name, Age, mail, Url, Product, Preferences)
VALUES ('$name', '$age', '$mail', '$url', '$product', '$check')
");
}
if ($result) {
echo ("Добавление прошло успешно");
} else {
echo ("Данные не были добавлены");
}
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question