Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP] unexpected T_VARIABLE, expecting T_CASE or T_DEFAULT
Forum PHP.pl > Forum > PHP
felixk
mam jeszcze taki problem, bo o ile faktycznie wartości zmienna już ma. Dziękuję za wzór, to teraz nie wczytuje mi zawartości pliku z instrukcji switch. Co robię źle i jak to poukładać?

Komunikat błędu:

Parse error: syntax error, unexpected T_VARIABLE, expecting T_CASE or T_DEFAULT or '}' in ...... on line 108

  1.  
  2. $tab1 = array('<p>', '</p>');
  3. $tab2 = array("", "");
  4.  
  5. if(!isset($_GET['edytor']))
  6.  
  7. {
  8.  
  9. $_GET['edytor'] = 'edytor.php';
  10.  
  11. }
  12.  
  13.  
  14. switch($_GET['edytor'])
  15.  
  16. {
  17.  
  18. $ile = count($files);
  19.  
  20. echo '<select onchange="self.location.href = this.value">
  21. <option VALUE="-- Wybierz podstronę --" selected>Wybierz podstronę</option>';
  22.  
  23. for( $x = 0; $x < $ile; $x++ )
  24. {
  25. echo '<option value="edytor.php?edytor=' . $files[$x] . '">' . $files[$x] . '</option>';
  26. }
  27. echo '</select>';
  28. echo '<input class="submit" type="submit" value="Zapisz" />';
  29.  
  30.  
  31. echo'</form>';
  32.  
  33. case 'o_nas':
  34.  
  35. echo'<form method="post"><textarea name="content" cols="90" rows="10">';
  36. $a = file_get_contents('../'.$files[$x].'');
  37. echo $a;
  38. echo '</textarea><br />';
  39.  
  40. echo '<input class="submit" type="submit" value="Zapisz" />';
  41. $editor_data = stripslashes($_POST['content']);
  42. $editor_data = str_replace($tab1, $tab2, $editor_data);
  43. $editor_data = html_entity_decode($editor_data);
  44. $b = file_put_contents('../'.$files[$x].'',$editor_data);
  45.  
  46. echo'</form>';
  47. break;
  48.  
  49.  
  50. case 'dzialalnosc_tpd':
  51.  
  52. echo'<div style="text-align: center"><form method="post"><textarea name="content" cols="90" rows="10">';
  53. $a = file_get_contents('../'.$files[$x].'');
  54. echo $a;
  55. echo '</textarea><br />';
  56.  
  57. echo ' <input class="submit" type="submit" value="Zapisz" />';
  58. $editor_data = stripslashes($_POST['content']);
  59. $editor_data = str_replace($tab1, $tab2, $editor_data);
  60. $editor_data = html_entity_decode($editor_data);
  61. $b = file_put_contents('../'.$files[$x].'',$editor_data);
  62.  
  63. echo'</form>';
  64. break;
  65.  
  66.  
  67. case 'jeden_procent':
  68.  
  69. echo'<form method="post"><textarea name="content" cols="90" rows="10">';
  70. $a = file_get_contents('../'.$files[$x].'');
  71. echo $a;
  72. echo '</textarea><br />';
  73.  
  74. echo ' <input class="submit" type="submit" value="Zapisz" />';
  75. $editor_data = stripslashes($_POST['content']);
  76. $editor_data = str_replace($tab1, $tab2, $editor_data);
  77. $editor_data = html_entity_decode($editor_data);
  78. $b = file_put_contents('../'.$files[$x].'',$editor_data);
  79. echo'</form>';
  80. break;
  81.  
  82.  
  83. case 'sow_tpd':
  84.  
  85. echo'<form method="post"><textarea name="content" cols="90" rows="10">';
  86. $a = file_get_contents('../'.$files[$x].'');
  87. echo $a;
  88. echo '</textarea><br />';
  89.  
  90. echo ' <input class="submit" type="submit" value="Zapisz" />';
  91. $editor_data = stripslashes($_POST['content']);
  92. $editor_data = str_replace($tab1, $tab2, $editor_data);
  93. $editor_data = html_entity_decode($editor_data);
  94. $b = file_put_contents('../'.$files[$x].'',$editor_data);
  95.  
  96. echo'</form>';
  97.  
  98. break;
  99.  
  100.  
  101. case 'sow_tpd_adresy':
  102.  
  103. echo'<form method="post"><textarea name="content" cols="90" rows="10">';
  104. $a = file_get_contents('../'.$files[$x].'');
  105. echo $a;
  106. echo '</textarea><br />';
  107.  
  108. echo ' <input class="submit" type="submit" value="Zapisz" />';
  109. $editor_data = stripslashes($_POST['content']);
  110. $editor_data = str_replace($tab1, $tab2, $editor_data);
  111. $editor_data = html_entity_decode($editor_data);
  112. $b = file_put_contents('../'.$files[$x].'',$editor_data);
  113.  
  114. echo'</form>';
  115. break;
  116.  
  117.  
  118. case 'nasi_przyjaciele':
  119.  
  120. echo'<form method="post"><textarea name="content" cols="90" rows="10">';
  121. $a = file_get_contents('../'.$files[$x].'');
  122. echo $a;
  123. echo '</textarea><br />';
  124.  
  125. echo ' <input class="submit" type="submit" value="Zapisz" />';
  126. $editor_data = stripslashes($_POST['content']);
  127. $editor_data = str_replace($tab1, $tab2, $editor_data);
  128. $editor_data = html_entity_decode($editor_data);
  129. $b = file_put_contents('../'.$files[$x].'',$editor_data);
  130.  
  131. echo'</form>';
  132. break;
  133.  
  134.  
  135. case 'zostan_naszym_przyjacielem':
  136.  
  137. echo'<form method="post"><textarea name="content" cols="90" rows="10">';
  138. $a = file_get_contents('../'.$files[$x].'');
  139. echo $a;
  140. echo '</textarea><br />';
  141.  
  142. echo ' <input class="submit" type="submit" value="Zapisz" />';
  143. $editor_data = stripslashes($_POST['content']);
  144. $editor_data = str_replace($tab1, $tab2, $editor_data);
  145. $editor_data = html_entity_decode($editor_data);
  146. $b = file_put_contents('../'.$files[$x].'',$editor_data);
  147.  
  148. echo'</form>';
  149. break;
  150.  
  151.  
  152. case 'rzecznik_praw_dziecka':
  153.  
  154. echo'<form method="post"><textarea name="content" cols="90" rows="10">';
  155. $a = file_get_contents('../'.$files[$x].'');
  156. echo $a;
  157. echo '</textarea><br />';
  158.  
  159. echo '<input class="submit" type="submit" value="Zapisz" />';
  160. $editor_data = stripslashes($_POST['content']);
  161. $editor_data = str_replace($tab1, $tab2, $editor_data);
  162. $editor_data = html_entity_decode($editor_data);
  163. $b = file_put_contents('../'.$files[$x].'', $editor_data);
  164.  
  165. echo'</form>';
  166. break;
  167.  
  168.  
  169. case 'obchody_roku_korczakowskiego':
  170.  
  171. echo'<form method="post"><textarea name="content" cols="90" rows="10">';
  172. $a = file_get_contents('../'.$files[$x].'');
  173. echo $a;
  174. echo '</textarea><br />';
  175.  
  176. echo ' <input class="submit" type="submit" value="Zapisz" />';
  177. $editor_data = stripslashes($_POST['content']);
  178. $editor_data = str_replace($tab1, $tab2, $editor_data);
  179. $editor_data = html_entity_decode($editor_data);
  180. $b = file_put_contents('../'.$files[$x].'', $editor_data);
  181.  
  182. echo'</form>';
  183.  
  184. break;
  185.  
  186. default:
  187. echo ' domyślny tekst';
  188. }
Mephistofeles
Mógłbyś podać w której linii wywala błąd.
$ile = count($files);
Czyżby w tej?
szyku
Po pierwsze, zamknij switch'a klamrą(}).
felixk
Cytat(Mephistofeles @ 14.06.2012, 23:06:45 ) *
Mógłbyś podać w której linii wywala błąd.
$ile = count($files);
Czyżby w tej?


w 108
Spawnm
Forum nie parser! Zamykam.
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.