0

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

2
  • 7
    $_REQUEST['o'] is not set. Commented Jan 21, 2014 at 22:50
  • Are you expecting o to be passed to your page via the query string? Commented Jan 21, 2014 at 22:52

2 Answers 2

2

$_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..

Sign up to request clarification or add additional context in comments.

Comments

1

o is not defined in the associative array $_REQUEST.

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

3 Comments

Hi Fabien, I did isset() and it does not show that error now. But where does it show the checked value.
isset checks if the value is set. If it returns false, the value is not set. Now your problem is that that value is not set, you need to figure out why not. How is 'o' supposed to be passed to your page? GET or POST?
Thanks will have a look and if i get some problems I will re post it here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.