Topic: Undefined index

ok im trying to work on my calendar mod, and right now im trying to add the birthday section to the profile, and on line 800 i add

$birthday = $_POST['bday_year']."-".$_POST['bday_month']."-".$_POST['bday_day'];

and i get the error

Notice: Undefined index: bday_year in profile.php on line 800
Notice: Undefined index: bday_month in profile.php on line 800
Notice: Undefined index: bday_day in profile.php on line 800

than i try to edit the query info by adding this befor the implode(',', $temp)

birthday='.$birthday.', 

and i get the error "unable to update profile"


would anyone like to help me out?

Re: Undefined index

I'm guessing this is for 1.2. Otherwise you wouldn't have gotten that error message. The problem is that you can't access e.g. $_POST['bday_year'] unless it actually exists. What you need to do is to check if it is set before you access it.

E.g:

if (isset($_POST['bday_year']) && isset($_POST['bday_month']) && isset($_POST['bday_day']))
    $birthday = $_POST['bday_year']."-".$_POST['bday_month']."-".$_POST['bday_day'];
else
    // do something else here
"Programming is like sex: one mistake and you have to support it for the rest of your life."

3 (edited by Gizzmo 2004-12-08 04:19)

Re: Undefined index

and yes its for 1.2, im trying to convert my calendar mod

& thanx i figured it out, and got it to work.

but now im getin the same kinda error with a part of mod maybe you can help me out again

Notice: Undefined variable: topic in c:\AppServ\www\punbb\calendar.php on line 18

Notice: Undefined index: 6 in c:\AppServ\www\punbb\calendar.php on line 18

Notice: Undefined variable: posts in c:\AppServ\www\punbb\calendar.php on line 25

Notice: Undefined index: 6 in c:\AppServ\www\punbb\calendar.php on line 25

and what i have on thoes lines are $topic[$time]++; and $post[$time]++;

Re: Undefined index

It's the same problem. You can't access those variables unless they are set.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Undefined index

ok i made sure to make $topic, and $posts, arrays befor the while but im still getin the error

Notice: Undefined index: 6 in c:\AppServ\www\punbb\calendar.php on line 18

Notice: Undefined index: 6 in c:\AppServ\www\punbb\calendar.php on line 26

Re: Undefined index

It means at some point $time is 6 and there is no index 6 in $topic and $post. You'll have to do the same there. if (isset($topic[$time]) ...

"Programming is like sex: one mistake and you have to support it for the rest of your life."