Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Błąd przy wszytywaniu strony głównej
Forum PHP.pl > Forum > Przedszkole
jazzjack18
Witam!


Przy ładowani domyślnej strony wyskakuje błąd:
"Notice: Undefined index: id in /home/jail/home/snsi7/public_http/index.php on line 38"

Stronka znajduje sie pod adresem: http://strimer.eny.pwr.wroc.pl/

Poniżej jest kod strony:

CODE
$id = (int) $_GET['id'];
if(!isset($id)){
include("news.html");
} else if
($id==0){
include("news.html");
}else if($id==1){
include("news.html");
}else if($id==2){
include("wydarzenia.html");
}else if($id==3){
include("publikacje.html");
}else if($id==4){
include("galeria.html");
}else if($id==5){
include("tematy.html");
}else if($id==6){
include("pliki.html");
}else if($id==7){
include("wladze.html");
}else if($id==8){
include("czlonkowie.html");
}else if($id==9){
include("kontakt.html");
}else if($id==11){
include("linki.html");
}else if($id==12){
include("eib.html");
}else if($id==13){
include("expo.html");
}else if($id==14){
include("ien.html");
}else if($id==15){
include("inaguracja.html");
}else if($id==16){
include("iea.html");
}else if($id==17){
include("ifp.html");
}else if($id==18){
include("int.html");
}else if($id==19){
include("lumel.html");
}else if($id==20){
include("pasikurowice.html");
}else if($id==21){
include("rksep.html");
}else if($id==22){
include("szkolenie.html");
}else if($id==23){
include("automaticon.html");
}else{
echo "Brak tre¶ci o podanym ID";
}
?>


Gdyby ktoś mógłby mi pomóc w rozwiązaniu mojego problemu byłbym bardzo wdzięczny.
Pozdrawiam
Jacek


phpion
Zamień:
  1. <?php
  2. $id = (int) $_GET['id'];
  3. ?>

na:
  1. <?php
  2. $id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
  3. ?>
jazzjack18
Wielkie dzięki phpion Zastąpienie powyższego kodu rozwiązało mój problem 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.