Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]formularz, nie wyświetla danych
maras_
post 23.10.2009, 19:01:24
Post #1





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 9.08.2009

Ostrzeżenie: (0%)
-----


Witam.
Zamiast wyświetlić mi pod spodem wszystkie dane , nic się nie dzieje smile.gif Czy mogłby mi ktoś coś podpowiedzieć ? Nie znam jeszcze zbyt dobrze php i nie bardzo wiem w czym problem.

  1. <?php
  2. $imie = $_GET['imie'];
  3. @$nazwisko = $_GET['nazwisko'];
  4. @$ulica = $_GET['ulica'];
  5. @$nrdomu = $_GET['nrdomu'];
  6. @$kod = $_GET['kod'];
  7. @$miasto = $_GET['miasto'];
  8. @$kraj = $_GET['kraj'];
  9. @$telefon = $_GET['telefon'];
  10. if ($imie == "" and $nazwisko=="" and $kraj=="" and $telefon==""){
  11. print ("prosze podac wszytskie wymagane danee");
  12. return;
  13. }
  14. $link = mysql_connect ('localhost','marek','marek123','formularz');
  15. $flag = mysql_select_db("formularz");
  16. if (!$link and !$flag){
  17. echo 'problem z polaczeniem';
  18. }
  19. $query = "insert into osoba (imie, nazwisko, ulica, nrdomu, kod, miasto, kraj, telefon)";
  20. $query .="values('".$imie."','";;
  21. $query .=$nazwisko."','";
  22. $query .=$ulica."','";
  23. $query .=$nrdomu."','";
  24. $query .=$kod."','";
  25. $query .=$miasto."','";
  26. $query .=$kraj."','";
  27. $query .=$telefon."','";
  28. $query .=")";
  29. $result = $query;
  30. if (!$result){
  31. print ("problem z zapytaniem do bazy danych");
  32. mysql_close($link);
  33. }
  34. setcookie("id", "$id", time() + 3600*24*30);
  35. mysql_close($link);
  36. print ("dziekujemy za wypelnienie formularza");
  37. ?>
  38. <?php
  39. @$id = $_COOKIE["id"];
  40. $code1 = "";
  41. function getdata($id){
  42. $link = mysql_connect ('localhost','marek','marek123','formularz');
  43. $flag = mysql_select_db("formularz");
  44. if (!$link and !$flag){
  45. echo 'Problem';
  46. }
  47.  
  48. $query = "select * from osoba where id = ".$id;
  49. $result = mysql_query($query);
  50. if (!$result){
  51. echo 'odrzucone zapytanie';
  52. }
  53. $row = mysql_fetch_row($result);
  54. mysql_close($link);
  55. $res = $row[1]."<br>";
  56. $res = $row[2]."<br>";
  57. $res = $row[3]."<br>";
  58. $res = $row[4]."<br>";
  59. $res = $row[5]."<br>";
  60. $res = $row[6]."<br>";
  61. $res = $row[7]."<br>";
  62. $res = $row[8]."<br>";
  63. return $res;
  64. }
  65. if (!$id <> ""){
  66. $code1 = "<h2>Zostales rozpoznany jako:<br><br>";
  67. $code1 .=getdata($id);
  68. $code1 .= "</h2>";
  69. }
  70. else{
  71. include("dane.html");
  72. return;
  73. }
  74. $kod =
  75. "<html>".
  76. "<head></head>".
  77. "<body>".
  78. $code1.
  79. "</body>".
  80. "</html>";
  81. print ("$kod");
  82. ?>
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.08.2025 - 04:51