Hi, just a small question that is puzzing me at the moment.
I'm trying to filter incoming $POST vars, using the loop and preg_match combination below. My aim is to reassign the 'passed' variables into a little slice of the $POST array - let's call it $PASSED.
reset($_POST);
while(list($key,$val)=@each($_POST)){
/* catch the new nameserver fields into an array*/
if(preg_match("/nnsd/",$key)){
if($val && $val!=""){
$PASSED[$key]=$val;
$nsflag=1;
echo "<br> requesting $key to be updated to $val";
}
}
}
So then, I should be able to loop through the newly created $PASSED array, to view just those $_POST vars that passed the preg_match:
PHP:
if($nsflag==1){
/* go through entries to see which ones need changing */
while(list($key,$val)=@each($PASSED)){
echo "<br>nsarray $key is $val<br>";
}
}
The code parses, and the filter works fine ( echo statement is returning okay), but the assignment isn't working with $PASSED[$key]=$val; so the $PASSED array is empty.
Anyone know how I can manage this assignment?
thanks guys!
Christo