Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Rozdzielność skryptów php !, dluga zawartość - ale proszę o pomoc
alpin19
post 13.03.2005, 22:16:45
Post #1





Grupa: Zarejestrowani
Postów: 50
Pomógł: 0
Dołączył: 9.02.2005

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


Witam
Probuję właśnie stworzyć panel administracyjny do zarządzania bazą danych, a konkretnie do dodawania do niej konkretnych danych.

Nijak nie mogę wysłać danych do bazy.
Co prawda wysyłam dane przez METHOD=GET do następnej strony która powinna je zapisać ale tak się nie dzieje.

1. Plik w którym podaję dane do zapisu:
  1. <head>
  2. <title>PANEL ADMINISTRACYJNY</title>
  3. <meta http-equiv="Content Type" content="text/html; charset=iso-8859-2">
  4. </head>
  5. <body bgcolor="#e5e8d1" align="center">
  6. <form name="ksiegarnia1-dodawanie" action="podglad.php" method="post">
  7. <table align="center" cellspacing="1" cellpadding="1" bgcolor="#060700">
  8. <tr>
  9. <td height="500" width="920" bgcolor="#5c6042">
  10. <table bgcolor="#33390b" cellspacing="1" cellpadding="1" align="center" valign="middle">
  11. <tr>
  12. <td height="20" width="903" bgcolor="#9a9f75" align="center">
  13. <font size="" color="">WPROWADZANIE NOWYCH POZYCJI</font>
  14. </td>
  15. </tr>
  16. </table>
  17. </br>
  18. <table bgcolor="#33390b" cellspacing="1" cellpadding="1" align="center" valign="middle">
  19. <tr>
  20. <td height="30" width="300" bgcolor="#9a9f75" align="center">
  21. <font size="" color="">NAZWA PRODUKTU</font>
  22. </td>
  23.  
  24. <td height="30" width="300" bgcolor="#9a9f75" align="center">
  25. <font size="" color="">ILOSC SZTUK</font>
  26. </td>
  27.  
  28. <td height="30" width="300" bgcolor="#9a9f75" align="center">
  29. <font size="" color="">CENA JEDNOSTKOWA</font>
  30. </td>
  31. </tr>
  32.  
  33. <tr>
  34. <td height="30" width="300" bgcolor="#9a9f75" align="center">
  35. <input type="text" name="product_name">
  36. </input>
  37. </td>
  38.  
  39. <td height="30" width="300" bgcolor="#9a9f75" align="center">
  40. <input type="text" name="product_number">
  41. </input>
  42. </td>
  43.  
  44. <td height="30" width="300" bgcolor="#9a9f75" align="center">
  45. <input type="text" name="product_price">
  46. </input>
  47. </td>
  48. </tr>
  49.  
  50. <tr>
  51. <td height="30" width="300" bgcolor="#9a9f75" align="center">
  52. <font size="" color="">KOD ISBN (JEŚLI ISTNIEJE)</font>
  53. </td>
  54.  
  55. <td height="30" width="300" bgcolor="#9a9f75" align="center">
  56. <font size="" color="">KOD EAN (JEŚLI ISTNIEJE)</font>
  57. </td>
  58.  
  59. <td height="30" width="300" bgcolor="#9a9f75" align="center">
  60. <font size="" color="">WYTWÓRCA</font>
  61. </td>
  62. </tr>
  63.  
  64. <tr>
  65. <td height="30" width="300" bgcolor="#9a9f75" align="center">
  66. <input type="text" name="product_isbn">
  67. </input>
  68. </td>
  69.  
  70. <td height="30" width="300" bgcolor="#9a9f75" align="center">
  71. <input type="text" name="product_ean">
  72. </input>
  73. </td>
  74.  
  75. <td height="30" width="300" bgcolor="#9a9f75" align="center">
  76. <input type="text" name="product_manufacture">
  77. </input>
  78. </td>
  79. </tr>
  80.  
  81. </table>
  82. </br>
  83. <table bgcolor="#33390b" cellspacing="1" cellpadding="1" align="center" valign="middle">
  84. <tr>
  85. <td height="30" width="500" bgcolor="#9a9f75" align="center">
  86. <font size="" color="">OPIS PRODUKTU</font>
  87. </td>
  88.  
  89. <td height="30" width="400" bgcolor="#9a9f75" align="center">
  90. <font size="" color="">ILUSTRACJA</font>
  91. </td>
  92. </tr>
  93. <tr>
  94. <td height="160" width="500" bgcolor="#9a9f75" align="center">
  95. <textarea name="product_char" cols="60" rows="7">
  96. </td>
  97.  
  98. <td height="160" width="400" bgcolor="#9a9f75" align="center">
  99. <input type="file" name="product_picture">
  100. </input></br>
  101. <font size="2">
  102. Obrazek nie powinien być większy niż 300x300px, oraz jego objętość nie powinna przekraczać 125Kb
  103. </font>
  104. </td>
  105. </tr>
  106. </table>
  107. </br>
  108. <table bgcolor="#33390b" cellspacing="1" cellpadding="1" align="center" valign="middle">
  109. <tr>
  110. <td height="30" width="450" bgcolor="#9a9f75" align="center">
  111. <input type="submit" value="Prześlij dalej aby zatwierdzić !">
  112. </td>
  113.  
  114. <td height="30" width="450" bgcolor="#9a9f75" align="center">
  115. <input type="reset" value="Oczyść wszystkie pola !">
  116. </td>
  117. </tr>
  118. </table>
  119. </td>
  120. </tr>
  121. <font size="2">
  122. Site Created by Karol Lipnicki @ 2005
  123. </font>
  124. </form>
  125. </body>
  126. </html>


2. Plik który powinien zapisać dane do bazy:
  1. <html>
  2. <head>
  3. <title>PANEL ADMINISTRACYJNY</title>
  4. <meta http-equiv=\"Content Type\" content=\"text/html; charset=iso-8859-2\">
  5. </head>
  6. <body bgcolor=\"#e5e8d1\" align=\"center\">
  7. <?php
  8. //podglad.php
  9.  
  10. $link_id = mysql_connect(&#092;"localhost\", \"alpin19\", \"\");
  11. $result = mysql_list_dbs($link_id);
  12. $num_rows = mysql_num_rows($result);
  13. ?>
  14.  
  15.  <form name=\"ksiegarnia1-dodawanie\" action=\"podglad.php\" method=\"post\">
  16.  <table align=\"center\" cellspacing=\"1\" cellpadding=\"1\" bgcolor=\"#060700\">
  17. <tr>
  18. <td height=\"500\" width=\"920\" bgcolor=\"#5c6042\">
  19.  <table bgcolor=\"#33390b\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\" valign=\"middle\">
  20.  <tr>
  21.  <td height=\"20\" width=\"903\" bgcolor=\"#9a9f75\" align=\"center\">
  22.  <font size=\"\" color=\"\">WPROWADZANIE NOWYCH POZYCJI</font>
  23.  </td>
  24.  </tr>
  25.  </table>
  26.  </br>
  27.  <table bgcolor=\"#33390b\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\" valign=\"middle\">
  28.  <tr>
  29.  <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
  30.  <font size=\"\" color=\"\">NAZWA PRODUKTU</font>
  31.  </td>
  32.  
  33.  <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
  34.  <font size=\"\" color=\"\">ILOSC SZTUK</font>
  35.  </td>
  36.  
  37.  <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
  38.  <font size=\"\" color=\"\">CENA JEDNOSTKOWA</font>
  39.  </td>
  40.  </tr>
  41.  
  42.  <tr>
  43.  <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
  44.  <?php
  45.  echo $product_name;
  46.  ?>
  47.  </td>
  48.  
  49.  <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
  50.  <?php
  51.  echo $product_number;
  52.  ?>
  53.  </td>
  54.  
  55.  <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
  56.  <?php
  57.  echo $product_price;
  58.  ?>
  59.  </td>
  60.  </tr>
  61.  
  62.  <tr>
  63.  <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
  64.  <font size=\"\" color=\"\">KOD ISBN (JEŚLI ISTNIEJE)</font>
  65.  </td>
  66.  
  67.  <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
  68.  <font size=\"\" color=\"\">KOD EAN (JEŚLI ISTNIEJE)</font>
  69.  </td>
  70.  
  71.  <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
  72.  <font size=\"\" color=\"\">WYTWÓRCA</font>
  73.  </td>
  74.  </tr>
  75.  
  76.  <tr>
  77.  <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
  78.  <?php
  79.  echo $product_isbn;
  80.  ?>
  81.  </td>
  82.  
  83.  <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
  84.  <?php
  85.  echo $product_ean;
  86.  ?>
  87.  </td>
  88.  
  89.  <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\">
  90.  <?php
  91.  echo $product_manufacture;
  92.  ?>
  93.  </td>
  94.  </tr>
  95.  
  96.  </table>
  97.  </br>
  98.  <table bgcolor=\"#33390b\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\" valign=\"middle\">
  99. <tr>
  100. <td height=\"30\" width=\"500\" bgcolor=\"#9a9f75\" align=\"center\">
  101.  <font size=\"\" color=\"\">OPIS PRODUKTU</font>
  102.  </td>
  103.  
  104.  <td height=\"30\" width=\"400\" bgcolor=\"#9a9f75\" align=\"center\">
  105.  <font size=\"\" color=\"\">ILUSTRACJA</font>
  106.  </td>
  107.  </tr>
  108.  <tr>
  109.  <td height=\"160\" width=\"500\" bgcolor=\"#9a9f75\" align=\"center\">
  110.  <textarea name=\"product_char\" cols=\"60\" rows=\"7\">
  111.  </textarea>
  112.  </td>
  113.  
  114.  <td height=\"160\" width=\"400\" bgcolor=\"#9a9f75\" align=\"center\">
  115.  <input type=\"file\" name=\"product_picture\">
  116.  </input></br>
  117.  <font size=\"2\">
  118.  Obrazek nie powinien być większy niż 300x300px, oraz jego objętość nie pow
  119. nna przekraczać 125Kb
  120.  </font>
  121.  </td>
  122.  </tr>
  123.  </table>
  124.  </br>
  125.  <table bgcolor=\"#33390b\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\" valign=\"middle\">
  126.  <tr>
  127.  <td height=\"30\" width=\"450\" bgcolor=\"#9a9f75\" align=\"center\">
  128.  <input type=\"submit\" value=\"Zatwierdź jeśli dane są poprawne !\">
  129.  </td>
  130.  
  131.  <td height=\"30\" width=\"450\" bgcolor=\"#9a9f75\" align=\"center\">  
  132.  <input type=\"reset\" value=\"Oczyść wszystkie pola !\">
  133.  </td>
  134. </tr>
  135. </table>
  136. </td>
  137. </tr>
  138. </table>
  139. <?
  140. $query = &#092;"INSERT INTO ksiegarnia VALUES(NULL '$product_name', 
  141. '$product_number', 
  142. '$product_price',
  143. '$product_isbn',
  144. '$product_ean',
  145. '$product_manufacture',
  146.  NULL)&#092;";
  147. $result = mysql_query($query);
  148.  
  149.  ?> 
  150. <font size=\"2\">
  151. Site Created by Karol Lipnicki @ 2005
  152. </font>
  153. </form>
  154. </body>
  155. </html>


Jak zapewne zauważyliście skrypty php są od siebie poodzielane i zastanawia mnie to czy komunikują się one między sobą, czy też muszą być zamknięte w jednym
  1. <?php
  2. ?>


Może wystarczy przesyłać wynik ze skryptu php poprzez jaką wartość lub polecenie. Proszę o pomoc !


--------------------
Początkujący PHP'owicz....
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 - 09:09