(text revised)
hello all. please take a look at my code. this is just a snippet of something, but the part i'm concerned with is the FOREACH loop, and the html i'm outputting-- trying to test why the session variable in the IF expression is NOT evaluating as the actual session-variable value, but instead-- (i think) its acting as if its a string?
notice that i've created a little html echo before during and after the FOREACH so i can see what's going on. the resulting screen html output shows the values as they appear in the array, only if i remove the $_SESSION[] bit, and leave $varloop (which of course, should replace $tempy, as also did the original session var before i tried the eval() thing)
i really have no idea what's happening... so looking for those of you w/ experience. thanks!
edit: out of forum-practice here-- i should explain that the whole point is i'm trying to evaluate whether a form entry is valid or not by looping through an array, and putting the form field values into session like that.
is this breaking because it's a bad idea, or bad execution of an otherwise functional idea?
<!-- heredoc2 end --></div>
EODREP;
$htmlvisible = $htmlreport;
$tempecho = "<div class=\"formtable\"><p class=\"errortrip\">";
$js = "<ul>";
// must validate form and show results
$formvariables = array('las_name','fir_name','age','email','phone','street_addr','city','zip');
foreach($formvariables as $varloop) {
if ($_SESSION['$varloop'] = '') {
$tempecho .= "Your entry was rejected because you MUST submit info for each required field!</p><p>We're sorry to ask you to <a href=\"schedule.php\">submit another form</a>, but our server has rejected your entry. Please try again.</p><p>Thank you for your understanding.</p> <!-- end of general-error --> </div>";
} else $tempecho = $tempecho;
/* test why the session variable evaluated by the IF logic is NOT giving me what i expect (i'm expecting the $formvariables array value) */
/* $tempy = eval(echo $_SESSION[$varloop];); */
$js .= "<li>before it and ".$tempy." after the dynmic data </li>";
}
$js .= "</ul>";
echo $js;