Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

Undefined index Question

Aloittaja eeek, joulukuu 05, 2005, 02:57:26 IP

« edellinen - seuraava »

eeek

I have a - 8: Undefined index: act  - in index.php

I know what act is :) I put it there, its a $_REQUEST['act'] for something I'm doing.

It works the way I want so its not a big problem.

The question is whats "8: Undefined index:" mean? an undifined variable?

and if it is where would I define it to stop the Error Log picking it up, or how would I go about stopping the error?

The easy solution - turn off the error log :)

Compuart

Undefined index means the index doesn't exist but is still used. The easiest way to prevent this error is to check whether the index exists before using it:

<?php
if (isset($_REQUEST['act']))
{
do_something_useful($_REQUEST['act']);
}
?>
Hendrik Jan Visser
Former Lead Developer & Co-founder www.simplemachines.org
Personal Signature:
Realitynet.nl -> ExpeditieRobinson.net / PekingExpress.org / WieIsDeMol.Com

eeek

Cheers

if (isset($_REQUEST['act']))   worked perfect.

So simple when you no how, should have though of that myself  :-[  rather than  look for a more complicated solution :)

carlatf

Hi,
I have exactly the same problem,  this error is flooding my logs.

What I don't understand is where I have to put these lines:

<?php
if (isset($_REQUEST['act']))
{
   do_something_useful($_REQUEST['act']);
}
?>

inside index.php?.

Saludos! :)
Carla

BigMike

#4
I've got this same problem and I'm trying to get some suggestions to work, but so far no go.

I recently coded and installed my own banner script that randomly displays different banners depending on which board the user is in.

Today I was just checking my error log and found I have 1143 pages of errors!!!!

99% of these are:

8: Undefined index: current_board
File: Themes/default/BoardIndex.template.php (eval?)
Line: 200

8: Undefined index: current_board
File: Themes/default/Login.template.php (eval?)
Line: 200

8: Undefined index: current_board
File: Themes/default/Errors.template.php (eval?)
Line: 205

8: Undefined index: current_board
File: Themes/default/Recent.template.php (eval?)
Line: 205

..... Who.english.php, Register.template,php, PersonalMessage.template.php, etc.


The way I made my banner script, is I placed it into a .js file and used:
<script src="', $settings['default_theme_url'], '/banner.js" type="text/javascript"></script>
from my index.template.php file within the <head></head> to access it.

The way I am calling it is:
if (empty($settings['header_logo_url']))
echo ' <script>banner(', $context['current_board'], ')</script>';



banner(', $context['current_board'], ') calls the javascript function "banner(thisboard)" from the file banner.js and sends the current board number into the function for use.

I have ONLY modified index.template.php and nothing else.

Everything is working Great! and I love how I wrote the code by myself and got it to work on my own :)

I have tried the isset.....do_something_useful fix and can't get it to work.

Anyone have any ideas? I am ready to search how errors are stored in the log, and to ignore the error for "8: Undefined index: current_board".

Thanks in advance
BigMike

Advertisement: