'i intended to send some information and their value to fill up the columns in the database. Such information are title, image ,description ,and price
echo '<pre>';
var_dump($_FILES);
echo '</pre>';
exit;
$errors = [];
$title = '';
$price = '';
$description = '';
echo $_SERVER['REQUEST_METHOD'].'<br>';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {}
$title = isset($_POST ['title']);//test
$description = isset($_POST['description']);
$price =isset ($_POST ['price']);
$date = date ('Y-m-d H:i:s');
if (!$title) {
$errors[] = 'product title is required';
}
if (!$price) {
$errors[] = 'product price is required';
}
$statement = $pdo->prepare("INSERT INTO products (title, image, description, price, create_date)
VALUE (:title, :image, :description, :price, :date)");
$statement->bindValue(':title', $title);
$statement->bindValue(':image', '');
$statement->bindValue(':description', $description);
$statement->bindValue(':price', $price);
$statement->bindValue(':date', $date);
$statement->execute();
?>
I intended to send some information and their value to fill up the columns in the database. Such information as title, image ,description ,and price. But after sending the information, their values wasn't reflected on the database.
The columns were created with just date and time recorded on each while other values such as title ,description and price wasn't recorded on the columns
Please I need help
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|