Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: formularz-pole text i file
Forum PHP.pl > Forum > PHP
fusilis
Ponizej moj kod, mam problem jak za pomoca jednego buttona wyslac dane do bazy i jednoczesnie przeslac plik, zeby to chodzilo jako jedna forma ? jak polaczyc te dwa kody jednym buttonem. Z gory dzieki za pomoc

  1. <?php
  2. <form action=send1.php method=post>
  3. Podaj Id : <input type=text name=&#092;"id\" size=\"1\"><BR>
  4. Podaj autora : <input type=text name=&#092;"autor\" size=\"60\"><BR>
  5. Podaj tytul : <input type=text name=&#092;"tytul\" size=\"62\"><BR>
  6. Podaj wydawce : <input type=text name=&#092;"wydawca\" size=\"57\"><BR>
  7. <input type=&#092;"submit\" type=\"submit\" value=DOPISZ>
  8. </form>
  9.  
  10. <form action=&#092;"send2.php\" 
  11. method=&#092;"post\" enctype=\"multipart/form-data\">
  12. Wyslij plik: <input type=&#092;"file\" name=\"thefile\"><BR>
  13. <input type=&#092;"submit\" type=\"submit\" value=DOPISZ>
  14. </form>
  15. ?>
maker
  1. <?php
  2. <form action=\"\" method=\"post\" enctype=\"multipart/form-data\">
  3. Podaj Id : <input type=text name=\"id\" size=\"1\"><BR>
  4. Podaj autora : <input type=\"text\" name=\"autor\" size=\"60\"><BR>
  5. Podaj tytul : <input type=\"text\" name=\"tytul\" size=\"62\"><BR>
  6. Podaj wydawce : <input type=\"text\" name=\"wydawca\" size=\"57\"><BR>
  7. Wyslij plik: <input type=\"file\" name=\"thefile\"><BR>
  8. <input type=\"submit\" type=\"submit\" value=DOPISZ>
  9. </form>
  10. <pre>
  11. ';
  12. echo'$_POST';
  13. print_r($_POST);
  14. echo'$_FILES';
  15. print_r($_FILES);
  16. echo'</pre>';
  17. ?>
Kod
$_POST
Array
(
    [id] => 1
    [autor] => 2
    [tytul] => 3
    [wydawca] => 4
)
$_FILES
Array
(
    [thefile] => Array
        (
            [name] => Serial.txt
            [type] => application/octet-stream
            [tmp_name] => C:\WINDOWS\TEMP\php9E8.tmp
            [error] => 0
            [size] => 31
        )

)
fusilis
sory,ale nierozumie,moge prosic o male wyjasnionko ...
kyno
Połącz to w jeden formularz a dane odbierz odpowiednimi tablicami smile.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.