Jatin
Jatin

Reputation: 3089

PHP Error : Undefined Index

This is going to sound really stupid, but I cannot figure out why I am getting this error.

Notice: Undefined index: o in C:\inetpub\wwwroot\webres\OC_defaults.php

    $o = !empty($o) ? $o : $_REQUEST['o'];
    $ST_defaults["office"] = !empty($o) ? strtoupper($o) : $officeDefault;
    extract($ST_defaults);

Thanks, Jatin

Upvotes: 0

Views: 88

Answers (2)

hanshenrik
hanshenrik

Reputation: 21463

$_REQUEST['o'] is not set. .. a simple fix would be to add

if(!array_key_exists('o',$_REQUEST)){$_REQUEST['o']='';};

oh, also, don't use $_REQUEST, its bad practice, its lazy, where the data comes is unknown, corruption/overwriting is possible~

use $_COOKIE / $_POST / $_GET instead..

Upvotes: 2

Fabien Warniez
Fabien Warniez

Reputation: 2741

o is not defined in the associative array $_REQUEST.

You can check if it is defined by using isset($_REQUEST['o']).

Upvotes: 1

Related Questions