Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][MySQL][PHP]przechwycenie pola z formularza, jak?
kamil9012
post 11.04.2012, 14:43:30
Post #1





Grupa: Zarejestrowani
Postów: 71
Pomógł: 0
Dołączył: 7.02.2008

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


Mam takie formularz bez method="POST":
  1. <form id="myform" class="cols">
  2. <h3>HTML5 form with custom inputs</h3>
  3.  
  4. <label> email * <input type="email" required="required" minlength="9" /> </label>
  5. <label> username * <input type="text" name="username" minlength="5" /> </label>
  6. <label> Password <input type="password" name="password" minlength="4" /> </label>
  7. <label> Password check <input type="password" name="check" data-equals="password" /> </label>
  8.  
  9. <div class="clear"></div>
  10.  
  11. <button type="submit">Submit form</button>
  12. </form>


W jaki sposób mogę zapisać dane z tego formularza do bazy mysql?

Wcześniej używałem tego:
  1. $querys=mysql_query("INSERT INTO nazwa_tabeli VALUES ('$_POST[loginas]', '$_POST[name]', '$_POST[lname]'");

no ale teraz POST znika... i co mam zrobić?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
tolomei
post 11.04.2012, 14:49:47
Post #2





Grupa: Zarejestrowani
Postów: 450
Pomógł: 135
Dołączył: 18.11.2010
Skąd: Wschowa

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


Witaj.

Dzieje się tak ponieważ zapomniałeś stawić atrybutu w znaczniku form:

  1. <form id="myform" class="cols" method="post">


Gdy go nie wstawisz - domyślnym jest metoda get.

Powinieneś dodatkowo poczytać o SQL Injection.
Twój skrypt posiada poważne luki bezpieczeństwa.

Pozdrawiam.


--------------------
“ Computers are good at following instructions, but not at reading your mind. ”
- Donald Knuth
Go to the top of the page
+Quote Post
kamil9012
post 11.04.2012, 15:03:06
Post #3





Grupa: Zarejestrowani
Postów: 71
Pomógł: 0
Dołączył: 7.02.2008

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


Cytat
Gdy go nie wstawisz - domyślnym jest metoda get.


oto dokładnie mi chodziło.

Dziękuję bardzo.
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: 24.07.2025 - 18:35