I am working on a site and I am getting a
notice: undefined index: Id
I know its some simplicity, but it can not figure out where the problem really is.
Here's the code:
& lt ;? Php switch ($ _GET ['id']) {Default: Include ('page / Hello.FP'); break; Case "Testimonial": Include ('Page / Testimonial Php'); break; Case "FAQ": Include ('page / faq.php'); break; Case "raq": Include ('pages / raq.php'); break; Case "Contact": Include ('pages / contact.php'); break; }? & Gt;
Line 3 will be and
Any help would be greatly appreciated!
The reason is not always set in your url id = x
So, when you do not try switc hthe value there is no such thing what you should do:
& lt ;? Php $ id = isset ($ _ GET ['id'])? $ _GET ['id']: ''; // It's just a small, if second switch ($ id) {default: include ('page / Hello.FP'); break; Case "Testimonial": Include ('Page / Testimonial Php'); break; Case "FAQ": Include ('page / faq.php'); break; Case "raq": Include ('pages / raq.php'); break; Case "Contact": Include ('pages / contact.php'); break; }? & Gt;
Bascelle $ id = isset ($ _GET ['id'])? $ _GET ['id']: ''; What does this mean, if the ID is within the URL then use it, otherwise use empty string, the reason for the empty string is that it is default:
$ id will always be set to something like this.
Comments
Post a Comment