Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP]Nie wysyła pola tekstowego do bazy dancyh
Adam1808
post 12.10.2014, 13:13:39
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 12.10.2014

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


Witam.
  1. <div id="konto_dialog" title="Zarządzanie kontem">
  2. <form class="form-horizontal" method="post" action="konto.php">
  3. <div class="form-group">
  4. <label for="inputEmail3" class="col-sm-2 control-label">Imię</label>
  5. <div class="col-sm-10">
  6. <input type="email" type="text" class="form-control" id="inputEmail3" name="imie" value=<?php echo $_SESSION["user_name"]; ?>>
  7. </div>
  8. </div>
  9. <div class="form-group">
  10. <label for="inputEmail3" class="col-sm-2 control-label">Nazwisko</label>
  11. <div class="col-sm-10">
  12. <input type="email" type="text"class="form-control" id="inputEmail3" name="nazwisko" value=<?php echo $_SESSION["user_last_name"]; ?>>
  13. </div>
  14. </div>
  15. <div class="form-group">
  16. <input type="submit" class="form-control" id="inputEmail3" value="Zapamiętaj" >
  17. </div>
  18. </form>
  19. </div>

konto.php:
  1. <?php
  2.  
  3. include("../db_login.php");
  4.  
  5. $imie = $_POST["imie"];
  6. $nazwisko = $_POST["nazwisko"];
  7. $id = $_SESSION["user_id"];
  8.  
  9. mysql_query("UPDATE users SET Imie = '$imie', Nazwisko = '$nazwisko' WHERE ID = '$id'");
  10.  
  11. header("Location: index.php");
  12.  
  13.  
  14. ?>


I tutaj pojawia się problem- przycisk 'Zapamiętaj' działa tylko wtedy, gdy pola 'imie' i 'nazwisko' są puste. Po wpisaniu czegokolwiek w te pola przycisk nie reaguje, a w bazie danych nic się nie aktualizuje. Ktoś ma pomysł, jak to naprawić?
Z góry dziękuję smile.gif
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
viking
post 12.10.2014, 13:31:23
Post #2





Grupa: Zarejestrowani
Postów: 6 378
Pomógł: 1116
Dołączył: 30.08.2006

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


Zapewne masz błąd zapytania z którym w tym kodzie nic nie robisz. I zapewne błąd będzie na nazwach kolumn.
http://pl1.php.net/manual/en/function.mysql-error.php
Do tego kod jest podatny na SQL Injection.


--------------------
Go to the top of the page
+Quote Post
Pyton_000
post 12.10.2014, 14:31:22
Post #3





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

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


Kod
type="email"

Na prawdę wpisujesz tam adresy email?
Zmień to na text
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 - 17:17