Advertisement
Mr_D3a1h

Untitled

Aug 24th, 2023
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. <?php
  2. echo "privet";
  3.  
  4. $connection = new mysqli("127.0.0.1", "root", "123", "geydb1");
  5. if ($connection->connect_error) {
  6. die("Connection failed: " . $connection->connect_error);
  7. }
  8. else {
  9. echo "Connected successfully to the database.";
  10. }
  11. if ($_SERVER["REQUEST_METHOD"] == "POST") {
  12. // Подключение к базе данных
  13. include ('page1.php');
  14.  
  15.  
  16. // Получение данных из формы
  17. $role = $_POST["role"];
  18. $subject = $_POST["subject"];
  19. $price = $_POST["price"];
  20. $delivery_date = $_POST["delivery_date"];
  21. $payment1 = $_POST["payment1"];
  22. $payment2 = $_POST["payment2"];
  23. $payment3 = $_POST["payment3"];
  24. $supply = $_POST["supply"];
  25. $supply_size =$_POST["supply_size"];
  26. $pnd = $_POST["pnd"];
  27. $delivery = $_POST["delivery"];
  28. // Дополнительные поля ввода
  29.  
  30. // Выполнение SQL-запроса для добавления записи
  31. $query = "INSERT INTO doc_sogl_create (role, subject, price, delivery_date, payment1, payment2, payment3, supply,supply_size, pnd, delivery) VALUES ('$role', '$subject', '$price','$delivery_date', '$payment1', '$payment2', '$payment3','$supply', '$supply_size','$pnd', '$delivery')";
  32. $stmt = $connection->prepare($query);
  33. $stmt->bind_param("ssdsdddsssss", $role, $subject, $price, $delivery_date, $payment1, $payment2, $payment3, $supply, $supply_size, $pnd, $delivery);
  34. if ($stmt->execute()) {
  35. echo "Data inserted successfully.";
  36. } else {
  37. echo "Error: " . $stmt->error;
  38. }
  39.  
  40. $stmt->close();
  41.  
  42. $connection->close();
  43. }
  44.  
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement