review.php 584 B

123456789101112131415161718192021222324
  1. <?php
  2. $host = "kurek620.beget.tech";
  3. $username = "kurek620_baze";
  4. $password = "6910WASD579h";
  5. $database = "kurek620_baze";
  6. $review = $_POST["review"];
  7. $rating = $_POST["rating"];
  8. $mysql = new mysqli($host, $username, $password, $database);
  9. if($mysql->connect_error){
  10. die("Ошибка подключения". $mysql->connect_error);
  11. }
  12. $query = "INSERT INTO reviews (review, rating) VALUES ('$review', '$rating')";
  13. $result = $mysql->query($query);
  14. if(!$result){
  15. echo "Что то не так";
  16. }
  17. else{
  18. echo "<script>window.location.href = 'index.html';</script>";
  19. }
  20. ?>