Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]$_POST, $_post nie przesyła danych
azbest22
post 15.10.2011, 17:18:56
Post #1





Grupa: Zarejestrowani
Postów: 48
Pomógł: 0
Dołączył: 9.09.2010

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


login_form.php
  1. <center>
  2. <form name = "logowanie" method = "POST" action = "index.php">
  3. login:
  4. <input type ="text" name="user">
  5. <br>
  6. hasło:
  7. <input type ="password" name="pass">
  8. <br>
  9. <input type="button" name="submit" value="Wyslij">
  10. </form>
  11. </center>

index.php
  1. <?
  2. if (isset($_POST['user']) && isset($_POST['pass']) )
  3. {
  4. include "test_login.php";
  5. }
  6. else
  7. {
  8. include "login_form.php";
  9. }
  10. ?>

problem
przy pierwszym uruchomieniu strony strony ładuje formularz. po wypełnieniu i wciśnięciu buttona nic się nie dzieje widocznego. przy próbie wyświetlenia wartości ze zmiennych $_POST wywala błąd że nie ma takich. wydaje mi się że po wciśnięciu buttona nie wywołuje wogule index.php
pytanie brzmi co można było zepsuć bo juz sporo czasu się w to wpatruje i szukam przyczyny takiego stanu rzeczy
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 5)
cycofiasz
post 15.10.2011, 17:30:58
Post #2





Grupa: Zarejestrowani
Postów: 711
Pomógł: 127
Dołączył: 5.07.2008
Skąd: Łódź

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


Usuń zbędne spacje w htmlu, chodzi np o te: name = "
Go to the top of the page
+Quote Post
Rysh
post 15.10.2011, 17:36:56
Post #3





Grupa: Zarejestrowani
Postów: 821
Pomógł: 111
Dołączył: 11.09.2006
Skąd: Biała Podlaska

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


Moja recepta na sukces:
  1. echo "<pre>";
  2. print_r($_POST);
  3. echo "</pre>";


--------------------
Go to the top of the page
+Quote Post
azbest22
post 15.10.2011, 17:45:10
Post #4





Grupa: Zarejestrowani
Postów: 48
Pomógł: 0
Dołączył: 9.09.2010

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


usunięcie spacji nic nie dało.

wstawienie

  1. echo "<pre>";
  2. print_r($_POST);
  3. echo "</pre>";

skutkuje wyświetleniem
Array
(
)

chyba że nie tam wstawiłem.
poniżej kod po tych drobnych zmianach
index.php
  1. <?
  2. echo "<pre>";
  3. print_r($_POST);
  4. echo "</pre>";
  5. if (isset($_POST['user']) && isset($_POST['pass']) )
  6. {
  7. include "test_login.php";
  8. }
  9. else
  10. {
  11. include "login_form.php";
  12. }
  13. ?>

login_form.php
  1. <center>
  2. <form name="logowanie" method="POST" action="index.php">
  3. login:
  4. <input type="text" name="user">
  5. <br>
  6. hasło:
  7. <input type="password" name="pass">
  8. <br>
  9. <input type="button" name="submit" value="Wyslij">
  10. </form>
  11. </center>


wstawienie
  1. ini_set('display_errors','1');

nie daje też żadnych efektów.

Go to the top of the page
+Quote Post
croc
post 15.10.2011, 17:46:54
Post #5





Grupa: Zarejestrowani
Postów: 706
Pomógł: 108
Dołączył: 12.03.2010

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


Błąd jest taki, że masz input type="button" zamiast type="submit".
Go to the top of the page
+Quote Post
azbest22
post 15.10.2011, 17:50:01
Post #6





Grupa: Zarejestrowani
Postów: 48
Pomógł: 0
Dołączył: 9.09.2010

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


no i zadziałało.
dzięki za pomoc. do zamknięcia.
Go to the top of the page
+Quote Post

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 - 02:46