Please Help...problem-undefined index
Moderator: General Moderators
-
djamorpheus
- Forum Newbie
- Posts: 4
- Joined: Mon Jun 16, 2003 10:35 pm
Please Help...problem-undefined index
i dont understand i always get this message on my website http://www.djamorpheus.com/main.php
message: Notice: Undefined index: page in D:\webspace\resadmin\be122f7\djamorpheus.com\www\main.php on line 25
Please help me
message: Notice: Undefined index: page in D:\webspace\resadmin\be122f7\djamorpheus.com\www\main.php on line 25
Please help me
- trollll
- Forum Contributor
- Posts: 181
- Joined: Tue Jun 10, 2003 11:56 pm
- Location: Round Rock, TX
- Contact:
Assuming that you keep your updates somewhere outside of the php file, load them into an array and run through the array writing the value into a template I would first guess that your loop tries to access an array index that doesn't exist.
If not, can you post some of the code you use to run through and write the updates out?
If not, can you post some of the code you use to run through and write the updates out?
-
djamorpheus
- Forum Newbie
- Posts: 4
- Joined: Mon Jun 16, 2003 10:35 pm
- trollll
- Forum Contributor
- Posts: 181
- Joined: Tue Jun 10, 2003 11:56 pm
- Location: Round Rock, TX
- Contact:
You may want to check out php.net's documentation on arrays to brush up a bit.
Usually with an error that says something about an "undefined index" means that you have an array with a certain number of things stored in it and then it tried to get a value bigger than that number. For example:
would work, while
should give you an undefined index error, as the index (3) has not gotten defined yet.
hope that helps!
Usually with an error that says something about an "undefined index" means that you have an array with a certain number of things stored in it and then it tried to get a value bigger than that number. For example:
Code: Select all
$my_array = Array('one','two','three');
echo $my_arrayї2];Code: Select all
$my_array = Array('one','two','three');
echo $my_arrayї3];hope that helps!
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
djamorpheus
- Forum Newbie
- Posts: 4
- Joined: Mon Jun 16, 2003 10:35 pm
here is the code
<?php
ini_set("include_path", "C:\phpdev\www");
switch ($_GET["page"] ) {
case "pics":
include('pictures.php');
break;
case "contact":
include('contact.php');
break;
case "links":
include('links.php');
break;
case "mypics":
include('me.php');
break;
case "art":
include('art.php');
break;
case "about":
include('aboutme.php');
break;
case NULL:
include('home.php');
break;
default:
include('error.php');
break;
}
?>
<?php
ini_set("include_path", "C:\phpdev\www");
switch ($_GET["page"] ) {
case "pics":
include('pictures.php');
break;
case "contact":
include('contact.php');
break;
case "links":
include('links.php');
break;
case "mypics":
include('me.php');
break;
case "art":
include('art.php');
break;
case "about":
include('aboutme.php');
break;
case NULL:
include('home.php');
break;
default:
include('error.php');
break;
}
?>
This is what u did wrong.
it should be like this
correct me if im wrong.
Nas
Code: Select all
<?php
switch ($_GET["page"] ) {
?>Code: Select all
<?php
switch ($_GET['page'] ) {
?>Nas