Hadi1989

Untitled

Jul 6th, 2018
559
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. <?php
  2.     require_once 'conn.php';
  3.    
  4.     if(ISSET($_POST['save'])){
  5.         if(!empty($_POST['firstname']) && !empty($_POST['lastname']) && !empty($_POST['city']) && !empty($_POST['postal_code'])){
  6.             $firstname = $_POST['firstname'];
  7.             $lastname = $_POST['lastname'];
  8.             $city = $_POST['city'];
  9.             $postal_code = $_POST['postal_code'];
  10.            
  11.             $conn->query("INSERT INTO `member` VALUES('', '$firstname', '$lastname', '$city', '$postal_code')") or die(mysqli_errno());
  12.            
  13.             header('location: index.php');
  14.            
  15.         }else{
  16.             echo "<script>alert('Please complete the required field!')</script>";
  17.         }
  18.     }
  19. ?>
Advertisement
Add Comment
Please, Sign In to add comment