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:
<html> <head> <meta http-equiv="Content Type" content="text/html; charset=iso-8859-2"> </head> <body bgcolor="#e5e8d1" align="center"> <form name="ksiegarnia1-dodawanie" action="podglad.php" method="post"> <table align="center" cellspacing="1" cellpadding="1" bgcolor="#060700"> <tr> <td height="500" width="920" bgcolor="#5c6042"> <table bgcolor="#33390b" cellspacing="1" cellpadding="1" align="center" valign="middle"> <tr> <td height="20" width="903" bgcolor="#9a9f75" align="center"> </td> </tr> </table> </br> <table bgcolor="#33390b" cellspacing="1" cellpadding="1" align="center" valign="middle"> <tr> <td height="30" width="300" bgcolor="#9a9f75" align="center"> </td> <td height="30" width="300" bgcolor="#9a9f75" align="center"> </td> <td height="30" width="300" bgcolor="#9a9f75" align="center"> </td> </tr> <tr> <td height="30" width="300" bgcolor="#9a9f75" align="center"> <input type="text" name="product_name"> </input> </td> <td height="30" width="300" bgcolor="#9a9f75" align="center"> <input type="text" name="product_number"> </input> </td> <td height="30" width="300" bgcolor="#9a9f75" align="center"> <input type="text" name="product_price"> </input> </td> </tr> <tr> <td height="30" width="300" bgcolor="#9a9f75" align="center"> </td> <td height="30" width="300" bgcolor="#9a9f75" align="center"> </td> <td height="30" width="300" bgcolor="#9a9f75" align="center"> </td> </tr> <tr> <td height="30" width="300" bgcolor="#9a9f75" align="center"> <input type="text" name="product_isbn"> </input> </td> <td height="30" width="300" bgcolor="#9a9f75" align="center"> <input type="text" name="product_ean"> </input> </td> <td height="30" width="300" bgcolor="#9a9f75" align="center"> <input type="text" name="product_manufacture"> </input> </td> </tr> </table> </br> <table bgcolor="#33390b" cellspacing="1" cellpadding="1" align="center" valign="middle"> <tr> <td height="30" width="500" bgcolor="#9a9f75" align="center"> </td> <td height="30" width="400" bgcolor="#9a9f75" align="center"> </td> </tr> <tr> <td height="160" width="500" bgcolor="#9a9f75" align="center"> <textarea name="product_char" cols="60" rows="7"> </textarea> </td> <td height="160" width="400" bgcolor="#9a9f75" align="center"> <input type="file" name="product_picture"> <font size="2"> Obrazek nie powinien być większy niż 300x300px, oraz jego objętość nie powinna przekraczać 125Kb </font> </td> </tr> </table> </br> <table bgcolor="#33390b" cellspacing="1" cellpadding="1" align="center" valign="middle"> <tr> <td height="30" width="450" bgcolor="#9a9f75" align="center"> <input type="submit" value="Prześlij dalej aby zatwierdzić !"> </td> <td height="30" width="450" bgcolor="#9a9f75" align="center"> <input type="reset" value="Oczyść wszystkie pola !"> </td> </tr> </table> </td> </tr> </table> <font size="2"> Site Created by Karol Lipnicki @ 2005 </font> </form> </body> </html>
2. Plik który powinien zapisać dane do bazy:
<html> <head> <title>PANEL ADMINISTRACYJNY</title> <meta http-equiv=\"Content Type\" content=\"text/html; charset=iso-8859-2\"> </head> <body bgcolor=\"#e5e8d1\" align=\"center\"> <?php //podglad.php ?> <form name=\"ksiegarnia1-dodawanie\" action=\"podglad.php\" method=\"post\"> <table align=\"center\" cellspacing=\"1\" cellpadding=\"1\" bgcolor=\"#060700\"> <tr> <td height=\"500\" width=\"920\" bgcolor=\"#5c6042\"> <table bgcolor=\"#33390b\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\" valign=\"middle\"> <tr> <td height=\"20\" width=\"903\" bgcolor=\"#9a9f75\" align=\"center\"> <font size=\"\" color=\"\">WPROWADZANIE NOWYCH POZYCJI</font> </td> </tr> </table> </br> <table bgcolor=\"#33390b\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\" valign=\"middle\"> <tr> <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\"> <font size=\"\" color=\"\">NAZWA PRODUKTU</font> </td> <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\"> <font size=\"\" color=\"\">ILOSC SZTUK</font> </td> <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\"> <font size=\"\" color=\"\">CENA JEDNOSTKOWA</font> </td> </tr> <tr> <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\"> <?php ?> </td> <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\"> <?php ?> </td> <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\"> <?php ?> </td> </tr> <tr> <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\"> <font size=\"\" color=\"\">KOD ISBN (JEŚLI ISTNIEJE)</font> </td> <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\"> <font size=\"\" color=\"\">KOD EAN (JEŚLI ISTNIEJE)</font> </td> <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\"> <font size=\"\" color=\"\">WYTWÓRCA</font> </td> </tr> <tr> <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\"> <?php ?> </td> <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\"> <?php ?> </td> <td height=\"30\" width=\"300\" bgcolor=\"#9a9f75\" align=\"center\"> <?php ?> </td> </tr> </table> </br> <table bgcolor=\"#33390b\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\" valign=\"middle\"> <tr> <td height=\"30\" width=\"500\" bgcolor=\"#9a9f75\" align=\"center\"> <font size=\"\" color=\"\">OPIS PRODUKTU</font> </td> <td height=\"30\" width=\"400\" bgcolor=\"#9a9f75\" align=\"center\"> <font size=\"\" color=\"\">ILUSTRACJA</font> </td> </tr> <tr> <td height=\"160\" width=\"500\" bgcolor=\"#9a9f75\" align=\"center\"> <textarea name=\"product_char\" cols=\"60\" rows=\"7\"> </textarea> </td> <td height=\"160\" width=\"400\" bgcolor=\"#9a9f75\" align=\"center\"> <input type=\"file\" name=\"product_picture\"> </input></br> <font size=\"2\"> Obrazek nie powinien być większy niż 300x300px, oraz jego objętość nie pow nna przekraczać 125Kb </font> </td> </tr> </table> </br> <table bgcolor=\"#33390b\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\" valign=\"middle\"> <tr> <td height=\"30\" width=\"450\" bgcolor=\"#9a9f75\" align=\"center\"> <input type=\"submit\" value=\"Zatwierdź jeśli dane są poprawne !\"> </td> <td height=\"30\" width=\"450\" bgcolor=\"#9a9f75\" align=\"center\"> <input type=\"reset\" value=\"Oczyść wszystkie pola !\"> </td> </tr> </table> </td> </tr> </table> <? $query = \"INSERT INTO ksiegarnia VALUES(NULL '$product_name', '$product_number', '$product_price', '$product_isbn', '$product_ean', '$product_manufacture', NULL)\"; ?> <font size=\"2\"> Site Created by Karol Lipnicki @ 2005 </font> </form> </body> </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
<?php ?>
Może wystarczy przesyłać wynik ze skryptu php poprzez jaką wartość lub polecenie. Proszę o pomoc !