Advertisement
Nikita051

Untitled

Oct 22nd, 2022
1,082
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. <?php
  2.     session_start();
  3.     $local = 'localhost';
  4.     $loginbd = 'root';
  5.     $passbd = 'root';
  6.     $namebd = 'crm';
  7.     $link = mysqli_connect($local,$loginbd,$passbd,$namebd);
  8.    
  9.     if($_SESSION['auto'] === true){
  10.         include "html/add_client.html";
  11.         $name = $_POST['name'];
  12.         $surname = $_POST['surname'];
  13.         $patronymic = $_POST['patronymic'];
  14.         $number = $_POST['number'];
  15.         $email = $_POST['email'];
  16.         $address = $_POST['address'];
  17.         $description = $_POST['description'];
  18.         if(!empty($name) && !empty($surname)){
  19.             $query = mysqli_query($link,"INSERT INTO clients SET name='$name',surname='$surname',patronymic='$patronymic',number='$number',email='$email',address='$address',description='$description'") or die(mysqli_error($link));
  20.             header("Location:/main");
  21.         } else {
  22.             if(!empty($_POST)){
  23.                 echo "Please enter name and surname client";
  24.             }
  25.         }
  26.          
  27.     }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement