简体   繁体   中英

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

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

o is not defined in the associative array $_REQUEST .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM