Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> zapis zmiennych do txt
wladimirec
post
Post #1





Grupa: Zarejestrowani
Postów: 28
Pomógł: 7
Dołączył: 27.10.2004

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


witam
sorry jesli wyda sie komus to zbyt banalne, ale mam taki problem
chce podmienic istniejacy kod formularza zbierajacego dane metoda post
oto fragment kodu
  1. <?php
  2. //Add the shout to the database
  3. //
  4. if( isset($_GET['action']) && $_GET['action'] == &#092;"add\" )
  5. {
  6. $new_line = $_POST['name'].&#092;"|\".$_POST['email'].\"|\".date(\"H:i d-m-y\").\"|\".stripslashes(htmlspecialchars($_POST['message'])) . \"n\";
  7. if( ! $fp = fopen($text_file,&#092;"a\") )
  8. echo &#092;"Cannot open \" . $text_file . \"! Check the file rights.\"; 
  9. if( flock( $fp, LOCK_EX ) )
  10. {
  11. fwrite( $fp,$new_line );
  12. flock( $fp, LOCK_UN );
  13. } else {
  14. echo &#092;"Couldn't lock the file \" . $text_file . \"!\";
  15. }
  16. header(&#092;"Location: \" . $referer_url );
  17. }
  18. ?>

chcę aby w miejsce $_POST['name'] i $_POST['email'] byly wpisywane automatycznie zdefiniowane wczesniej dla zalogowanego uzytkownika dane
probowalem tak
  1. <?php
  2. //Add the shout to the database
  3. //
  4. if( isset($_GET['action']) && $_GET['action'] == &#092;"add\" )
  5. {
  6. $new_line = $name.&#092;"|\".$email.\"|\".date(\"H:i d-m-y\").\"|\".stripslashes(htmlspecialchars($_POST['message'])) . \"n\";
  7. if( ! $fp = fopen($text_file,&#092;"a\") )
  8. ......
  9. ?>


no i w oczekiwanych miejscach w pliku nie pojawia sie oczekiwana wartosc (IMG:http://forum.php.pl/style_emoticons/default/sad.gif)
pozostawiane sa puste miejsca

z gory dziekuje za podpowiedzi
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 16:09