Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Przejście pod wskazany adres PHP
Forum PHP.pl > Forum > Przedszkole
ArturEales
Witam jak za pomocą PHP przejść do innej strony?questionmark.gif Problem polega na tym że nie ma to być zwykłe przejście... tz. do strony np. www.nazwa.pl lub coś.php ... u mnie jest taki problem ze che jeszcze przesłać dane za pomocą GET czyli adres wyglądał by tak .... coś.php?zmienna=100.... Próbowałem za pomocą include, header i kilka skryptów które znalazłem w internecie ale niestety nic nie działa.

Z góry dzięki za pomoc!
Fifi209
header zapewniam, że działa.

Pokaż tylko jak próbowałeś.
ArturEales
  1. if($sys_stat == "100")
  2. {
  3. header("Location: edytor02.php?go=101");
  4. }else{
  5. header("Location: edytor02.php?go=102");
  6. }


i pojawia sie komunikat :
Warning: Cannot modify header information - headers already sent by
Pawel_W
prawdopodobnie wyświetlasz coś przed tą instrukcją, lub wstawiłeś jakąś spację przed tag php, ew. masz kodowanie pliku ustawione na utf8 z BOM smile.gif
ArturEales
nom wyświetlam formularz kodowanie mam na iso-8859-2 ustawione ma ktoś pomysł jak rozwiązać ten problem ?
Fifi209
Nagłówki muszą iść jako pierwsze ;] nie ma rady.
ArturEales
A mógłbyś troszkę jaśniej ? bo ja dziś bardzo słabo kontaktuje jakie nagłówki ?

Obecnie mój cały kod wygala tak...

  1. <? ob_start(); ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
  6. <meta name="Autor" content="000000" />
  7. <link rel="Stylesheet" type="text/css" href="style.css" />
  8. <link rel="stylesheet" href="style_menu.css" type="text/css" />
  9. <script type='text/javascript' src='jquery-1.2.3.min.js'></script>
  10. <script type='text/javascript' src='menu.js'></script>
  11. <script type="text/javascript" src="edytor/edt/ckeditor/ckeditor.js"></script>
  12. <title>0000000</title>
  13. <?
  14. mysql_connect ("localhost","root","");
  15. mysql_select_db ("text_strony");
  16. ?>
  17. </head>
  18. <body>
  19. <div class="Main">
  20. <div class="Sheet">
  21. <div class="Sheet-tl"></div>
  22. <div class="Sheet-menu"><div></div></div>
  23. <div class="nav">
  24. <ul class="artmenu">
  25. <li><a href="index.php"><span>Strona główna</span></a></li>
  26. <li><a href="edytor.php?go=100" class="active"><span>Edytor</span></a></li>
  27. <li><a href="ust.php"><span>Ustawienia</span></a></li>
  28. <li><a href="pomoc.php"><span>Pomoc</span></a></li>
  29. <li><a href="kontakt.php"><span>Kontakt</span></a></li>
  30. </ul>
  31. </div>
  32. <div class="Sheet-contentLayout">
  33. <ul id="nav">
  34. <li><a href="#">111111</a>
  35. <ul>
  36. <li><a target="R02" href="?go=1">79897879789</a></li>
  37. <li><a target="R02" href="?go=2">333333333</a></li>
  38. <li><a target="R02" href="?go=3">P22224</a>
  39. <ul>
  40. <li><a target="R02" href="?go=3">66666</a></li>
  41. <li><a target="R02" href="?go=4">4444444</a></li>
  42. </ul></li>
  43. <li><a target="R02" href="?go=5">22222222</a>
  44. <ul>
  45. <li><a target="R02" href="?go=5">0000i</a></li>
  46. <li><a target="R02" href="?go=6">5555</a></li>
  47. <li><a target="R02" href="?go=7">444444</a></li>
  48. <li><a target="R02" href="?go=8">11111</a></li>
  49. <li><a target="R02" href="?go=9">00000000</a></li>
  50. </ul></li>
  51. <li><a target="R02" href="?go=10">0000</a></li>
  52. <li><a target="R02" href="?go=11">000</a></li>
  53. <li><a target="R02" href="?go=12">00000</a>
  54. <ul>
  55. <li><a target="R02" href="?go=12">0000</a></li>
  56. <li><a target="R02" href="?go=13">00000</a></li>
  57. <li><a target="R02" href="?go=14">0000</a></li>
  58. <li><a target="R02" href="?go=15">00000</a></li>
  59. <li><a target="R02" href="?go=16">00000</a></li>
  60. </ul></li>
  61. <li><a target="R02" href="?go=17">Inne</a>
  62. <ul>
  63. <li><a target="R02" href="?go=17">0000</a></li>
  64. <li><a target="R02" href="?go=18">0000</a></li>
  65. </ul>
  66. </li> </ul>
  67. </li>
  68. </ul>
  69. <!-- Menu 1 Exit -->
  70. <!-- Menu 2 Start -->
  71. <ul id="nav">
  72. <li><a href="#">Edycja Wygladu</a>
  73. <ul>
  74. <li><a target="R02" href="?go=30">00000</a></li>
  75. <li><a target="R02" href="?go=31">11111</a></li>
  76. <li><a target="R02" href="?go=32">55555</a></li>
  77.  
  78. </ul>
  79. </li>
  80. </ul>
  81. <!-- Menu 2 Exit --> <br />
  82. <?
  83. $go = $_GET['go'] ;
  84. if ($_GET['go'] != '') {
  85.  
  86. switch ($go) {
  87.  
  88. case 1:
  89. $query = "SELECT ID, ZAW_PAGES FROM `bdskt` where ID=1";
  90. $result = mysql_query($query);
  91. while( $row = mysql_fetch_array( $result )){
  92. $textera_01 .= $row[ 'ZAW_PAGES' ].'';}
  93.  
  94. echo "<form method='post'>
  95. <p>
  96. <textarea name='editor1'> $textera_01 </textarea>
  97. <script type='text/javascript'>
  98. CKEDITOR.replace( 'editor1' );
  99. </script>
  100. </p>
  101. <p>
  102. <input type='hidden' name='zz1' value='true'>
  103. <input type='submit' value='' class='submit' />
  104. </p>
  105. </form>";
  106. if(isset($_POST['zz1']))
  107. {
  108. $editor_data_01 = $_POST[ 'editor1' ];
  109. $zapytanie = "UPDATE `bdskt` SET `ZAW_PAGES` = '$editor_data_01' WHERE `id`='1'";
  110. $idzapytania = mysql_query($zapytanie) and $sys_stat="100";
  111.  
  112. if($sys_stat == "100")
  113. {
  114. header('Location: edytor.php?go=101');
  115. }else{
  116. header("Location: edytor.php?go=102");
  117. }
  118. }
  119. break;
  120.  
  121. case 100:
  122. include'edytor/edt/strona_g.php';
  123. break;
  124.  
  125. case 101:
  126. include'edytor/edt/sukces_zapisz.php';
  127. break;
  128.  
  129. case 102:
  130. include'edytor/edt/error_zapisz.php';
  131. break;
  132.  
  133. case 103:
  134. include'edytor/edt/error.php';
  135. break;
  136.  
  137. default:
  138. include'edytor/edt/error.php';
  139. }
  140. }
  141.  
  142. ?>
  143. </div>
  144. <div class="Footer-text">
  145. <p>Copyright &copy; 2010-2011 Wszelkie prawa zastrzeżone.</p></div>
  146. <div class="Sheet-dolny"></div>
  147. </div></div>
  148.  
  149. </body>
  150. </html>
  151. <? ob_end_flush(); ?>
gigzorr
hmm ,srednik na dole nie domkniety przy end_flush , i gdzies div nie domknięty.
ArturEales
ok poprawiłem...ale nadal nie działa za to zauważyłem zmianę w błędzie: wcześniej było tak Warning: Cannot modify header information - headers already sent by (output started at [...]\edytor.php:7)

a teraz

Warning: Cannot modify header information - headers already sent by (output started at [...]\edytor.php:1)
Pawel_W
na 100% kodowanie, albo biały znak na początku pliku, przecież widzisz, że w linii 1
ArturEales
ufff dałem sobie rade dział smile.gif pousuwałem wszystkie spacje jakie tylko znalazłem tongue.gif i zaczęło dziać smile.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.