Hello, could you help me. I have a problem. When I don't write, nothing in the fields and click save, I save an empty field in the database. How can I do that.
<label>Title</label
<input class="form-control" type="text" name="title";
<label>Аuthor</label>
<input class="form-control" type="text" name="author">
................
<br>
<div style="padding-left: 10px;">
<button type="submit" name="save">save</button></div>
<?php
include 'config.php';
if(isset($_POST['save'])){
if($link->connect_error){
die('Connect failed: '.$link->connect_error);
} else{
$stmt=$link->prepare("insert into user_books(user_name_books,user_name_author,user_year,user_ISBAN) value(?,?,?,?)");
$stmt->bind_param("ssss",$title,$author,$year,$isban);
$execval=$stmt->execute();
if(!isset($title) || trim($title)=='') {
echo 'You did not fill out the required fields title';}
else {
if(!isset($author) || trim($author)==''){
echo " You did not fill out the required fields author";
}
else { if(!isset($year)|| trim($year)==''){
echo 'You did not fill out the required fields year';
}
else { if(!isset($isban) || trim($isban)==''){
echo 'You did not fill out the required fields isban';}
else {
header("Location: homeUserFinish.php"); }}