Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][MySQL][PHP]Dlaczego czyści dane z formularza?, Formularz nie przysyła edytowanych danych
konradkw
post
Post #1





Grupa: Zarejestrowani
Postów: 131
Pomógł: 0
Dołączył: 31.05.2010

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


Co tutaj jest nie tak?
Cokolwiek robię przesyłane sa tylko i wyłącznie czyste dane - dlaczego?

  1. if (isset($_POST['edit']))
  2. {
  3. $id = $_POST['id'];
  4. $ttt = mysql_query ("SELECT * FROM `vivian_articles` WHERE `id` = '$id'");
  5. while ($tt = mysql_fetch_array($ttt, MYSQL_ASSOC))
  6.  
  7. {
  8. echo '<center><FORM action="index.php?admin=articles" method="post"><input type="hidden" name="id" value="'.$tt['id'].'"><table>
  9.  
  10. <tr><td>Title</td><td><input name="title" type="text" size="98" value="'.$tt['title'].'"></td></tr>
  11.  
  12. <tr><td>Description</td><td><textarea name="description" cols="78">'.$tt['description'].'</textarea></td></tr>
  13. <tr><td>Key words:</td>
  14. <td>
  15. <input type="text" name="key1" size="15" value="'.$tt['key1'].'">
  16. <input type="text" name="key2" size="15" value="'.$tt['key2'].'">
  17. <input type="text" name="key3" size="15" value="'.$tt['key3'].'">
  18. <input type="text" name="key4" size="15" value="'.$tt['key4'].'">
  19. <input type="text" name="key5" size="15" value="'.$tt['key5'].'"><br>
  20. <input type="text" name="key6" size="15" value="'.$tt['key6'].'">
  21. <input type="text" name="key7" size="15" value="'.$tt['key7'].'">
  22. <input type="text" name="key8" size="15" value="'.$tt['key8'].'">
  23. <input type="text" name="key9" size="15" value="'.$tt['key9'].'">
  24. <input type="text" name="key10" size="15" value="'.$tt['key10'].'">
  25. </td></tr>
  26.  
  27. <tr><td>Article budy:</td><td><textarea name="body" cols="78" rows="15">'.$tt['body'].'</textarea></td></tr>
  28.  
  29. <tr><td></td><td><center><input type="submit" name="submitedit" value="Submit changes"></center></td></tr>
  30. </table></center>';
  31. }
  32. }
  33. /////////////////////////////////////////////////////////////////////////////////////////////
  34.  
  35. if (isset($_POST['submitedit']))
  36. {
  37. $id = $_POST['id'];
  38. $t = $_POST['title'];
  39. $d = $_POST['description'];
  40. $k1 = $_POST['key1'];
  41. $k2 = $_POST['key2'];
  42. $k3 = $_POST['key3'];
  43. $k4 = $_POST['key4'];
  44. $k5 = $_POST['key5'];
  45. $k6 = $_POST['key6'];
  46. $k7 = $_POST['key7'];
  47. $k8 = $_POST['key8'];
  48. $k9 = $_POST['key9'];
  49. $k10 = $_POST['key10'];
  50. $b = $_POST['body'];
  51.  
  52. $update = mysql_query("UPDATE `vivian_articles` SET `title` = '$t', `description` = '$d', `key1` = '$k1', `key2` = '$k2', `key3` = '$k3', `key4` = '$k4', `key5` = '$k5', `key6` = '$k6', `key7` = '$k7', `key8` = '$k8', `key9` = '$k9', `key10` = '$k10', `body` = '$b' WHERE `id` = '$id'");
  53.  
  54. if ($update) {
  55. echo "<center>UPDATED OK!</center>";
  56. } else {
  57. echo mysql_error(); echo '<p>Error! Please try again</p>';
  58. }
  59.  
  60. }
  61.  


Ten post edytował konradkw 27.08.2012, 22:29:52
Go to the top of the page
+Quote Post

Posty w temacie


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 Aktualny czas: 22.08.2025 - 08:08