Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Funkcja dołączona do Headera
fakir
post
Post #1





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 25.09.2012

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


Witam wszystkich,
Mam problem.
Otóż mamy taki kodzik:

  1. <?php
  2. function cfunkcyja($arg) {
  3. if (!empty($arg)) {
  4. echo "+$arg";
  5. }
  6. }
  7. ?>
  8. <?php
  9. $test = 'kupa';
  10. $test2 = 'mocz';
  11. header("Location: <a href="http://wielkakupa.pl/tag/mop&quot;" target="_blank">http://wielkakupa.pl/tag/mop"</a> .cfunkcyja($test).cfunkcyja($test2));

?>[/php]


Nie mogę uzyskać tego, aby header brzmiał i dzięki temu przekierowywał na odpowiednią stronę: http://wielkakupa.pl/tag/mop+kupa+mocz

Output mam:
+kupa+mocz
Warning: Cannot modify header information - headers already sent by (output started at /t.php:4) on line 12


Jak to zrobić? Jak dołączyć funkcję do Headera, aby był jednością?

Pomóżcie (IMG:style_emoticons/default/sad.gif)
Z góry dzięki!

Ten post edytował fakir 25.09.2012, 22:37:37
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
fakir
post
Post #2





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 25.09.2012

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


Dzięki wielkie za odpowiedź!
Niestety teraz znów mam Header sent already sent:

  1. <?php
  2.  
  3. function cparam($arg) {
  4. if (!empty($arg)) {
  5. return "+$arg";
  6. }
  7. }
  8.  
  9. $test = 'kupa';
  10. $test2 = 'mocz';
  11.  
  12. header("Location: <a href="http://kupa.pl/tag/$as_mop&quot;" target="_blank">http://kupa.pl/tag/$as_mop"</a> .cparam($test).cparam($test2));
  13.  
  14. ?>


  1. Warning: Cannot modify header information - headers already sent by (output started at /t.php:1) on line 13

BTW Korzystam z codepad.org, by to przetestować, ale chyba to nie tego wina.

Pozdrawiam!
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: 14.10.2025 - 06:19