Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP]Błąd wprowadzenia danych do bazy
-Laran-
post 17.03.2013, 12:27:37
Post #1





Goście







Witam.

Problem polega na tym że staram się wprowadzić dane do bazy przez PHP i nie mogę tego zrobić. Gdzie leży błąd?

  1. <?php
  2. require_once("connection.php");
  3.  
  4. if(!empty($_POST)){
  5. $indexTitle = $_POST["tytul"];
  6. $indexContent = $_POST["tresc"];
  7.  
  8. $adminIndexValues = "INSERT INTO `vm_index` VALUES('$indexTitle','$indexContent',now())";
  9. $adminIndex = mysql_query($adminIndexValues);
  10.  
  11. if(!$adminIndex) {
  12. echo "Błąd<br>";
  13. }
  14. if(empty($_POST["tytul"])) {
  15. echo "Brak tytułu<br>";
  16. }
  17. if(empty($_POST["tresc"])) {
  18. echo "Brak tresci<br>";
  19. }
  20. }
  21. ?>
  22.  
  23. <div id="regbox">
  24. <form action="admin_index.php" method="POST">
  25. <p>
  26. <label>Tytuł:</label> <input type="text" id="tytul" name="tytul" />
  27. </p>
  28. <p>
  29. <label>Treść:</label> <textarea id="tresc" name="tresc" rows="20" cols="50"></textarea>
  30. </p>
  31. <input type="submit" value="Dodaj">
  32. </form>
  33. </div>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.06.2025 - 14:06