Partial success!
Thank you to Haji, who helped me construct this...
<?
$newArray=$arrayname;
function exportArray($inarray)
{
foreach( $inarray as $aKey => $aValue)
{
if(!empty($aValue)){
$var_name = $aKey;
$$var_name = $aValue;
echo "<tr><td width=100>".$aValue."</td></tr>\n";
};
};
echo "<br>";
}
exportArray($newArray);
// the rest of my script VVVV down there
?>
Now, the NEW problem, grrr.
EVEN when i call exportArray(&$newArray); <-- by reference...it does not overwrite the "newArray" which was my hope so that I could export it to a file.
AND it seems inside the above function, i CANNOT write the variable "$aValue" to a file. I can echo it till the cows come home, LOL, but I cannot write it to a file?....what's up with that?
this is what I tried...
function exportArray($inarray)
{
@ $fp2 = fopen("$DOCUMENT_ROOT/fruitarray.txt", "a");
flock($fp2, 2);
if (!$fp2){
echo "<p><strong> The fruit array could not be processed at this time. "
."Please try again later.</strong></p></body>";
exit;
}
foreach( $inarray as $aKey => $aValue)
{
if(!empty($aValue)){
$var_name = $aKey;
$$var_name = $aValue;
echo "<tr><td width=100>".$aValue."</td></tr>\n"; // everything works up to here
$teamString = "$aValue"; // also tried $aValue bare w/ no quotes also...didn't work!
fwrite($fp2, $teamString); // tried $teamString bare and in quotes also
fwrite($fp2, "goo\n"); // breakpoint DOES NOT WRITE... conclusion: cannot write to file INSIDE a funtion. What's up with that????
};
};
flock($fp2, 3);
fclose($fp2);
echo "<br>";
}
Please help if you can....getting VERY frustrated!!!