PHP: how to make this variable have a value
Question
I have register globals on, I know, I know, bad idea, I didn't program the app, I just have to make it work while I work on their new app. Seems like the hosting company made some kind of update, know the app doesn't work.
function showfield($fldn_,$flds_,$edit_, $onch_='', $maxlen_='255',$format_='', $align_='left', $extra_='') {
switch ($format_) {
case 'curr':
$fldv_=curr($GLOBALS[$fldn_]);
break;
case 'currn':
$fldv_=currn($GLOBALS[$fldn_]);
break;
default:
$fldv_=$GLOBALS[$fldn_];
}
if($edit_=='2'){
echo '<input type="text" name="'.$fldn_.'" id="'.$fldn_.'" VALUE="'.$fldv_.'" SIZE="'.afsize($flds_).'"';
if ($onch_) echo " onChange=\"$onch_\"";
if ($maxlen_) echo " maxlength=\"$maxlen_\"";
if ($align_ and $align_<>'left') echo " style=\"text-align:$align_\"";
echo " $extra_>";
} else { echo $fldv_; }
}
Note this part of the function above... $fldv_=$GLOBALS[$fldn_];
That doesn't work anymore, it's supposed to add a value to VALUE="'.$fldv_.'"
. I don't know where it is supposed to get the value from. I did a search on the code and can't find a reference where the variable is set. Anyways, everything where $GLOBALS is, doesn't work anymore. I already set register_globals to On and IT IS on.
It used to work, but after the update, doesn't work anymore.
Solution
I used extract on $_POST to fix some problems, I just had to do it on $_GET too: PHP: translate POST into simple variables?
extract($_GET, EXTR_SKIP);