Jump to content

abadon

New Members
  • Posts

    2
  • Joined

  • Last visited

abadon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. problem with my code from php in mysql. I want to check not to send me an empty field in mysql when saving
  2. 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"); }}
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.