thx again everyone for your time in looking over my code - the whole idea hinged on being able to create variable names on the fly, and collect them on the "other side." - just FYI [ICYI-in case you're interested]:
scope: online evaluation pages where people either self-evaluate, or evaluators evaluate Staff members.
problem: select 2 choices of 5 tables to display on a page where either 3 tables display names, or 2 tables display names, respectively.
pertinent data displayed/used: tableName, staffName [Last, First], evaluatorName[Last, First].
$tableTag="St" if table is evalStaff; "Al" if table is evalAlternate, etc[used in creation of var names.]
in a loop, display the staffName, and evaluation data for each evaluator - may be multiple instances, since can be multiple evaluators.
using str_replace, modify staffName and evaluatorName so as to create valid PHP variable names for each textarea:
[the substance of the resolution all begins here:]
for each loop, dynamically create textarea names, such as "txt1StBrown_James0Wonder_Stevie" - using the replacement characters "" for ", ", i can $POST the variable name from the 2nd page. also, capture the evaluatorName in an array, pass to page 2.
then on the 2nd page, loop through evaluatorName, piecing together variable names using tableTag depending on related table, staffName, and evaluatorName such as:
"txt1StBrown_James0Wonder_Stevie"
"txt2StBrown_James0Wonder_Stevie"
"txt3StBrown_James0Wonder_Stevie"
for each staff/evaluator pair.
//======================= page 1: ======================
$staffName = $row['staffName'];
$evaluatorName = $row['evaluatorName'];
$txt1StVar = "txt1St".str_replace(', ', '_', $staffName)."0".str_replace(', ', '_', $evaluatorName);
$txt2StVar = "txt2St".str_replace(', ', '_', $staffName)."0".str_replace(', ', '_', $evaluatorName);
$txt3StVar = "txt3St".str_replace(', ', '_', $staffName)."0".str_replace(', ', '_', $evaluatorName);
//NOTE: 0 simply separates staff from evaluator
echo "<tr class='trStyle3'><td colspan='10'>Comments: Work Performance</td></tr>";
echo "<tr><td colspan='10'><textarea name='".$txt1StVar."' cols=40 rows=15 wrap=soft style='width:800px; height:100px; overflow:yes;'>$pt1Comments</textarea></td></tr>";
echo "<tr class='trStyle3'><td colspan='10'>Comments: Work Habits</td></tr>";
echo "<tr><td colspan='10'><textarea name='".$txt2StVar."' cols=40 rows=15 wrap=soft style='width:800px; height:100px; overflow:yes;'>$pt2Comments</textarea></td></tr>";
echo "<tr class='trStyle3'><td colspan='10'>Additional Comments</td></tr>";
echo "<tr><td colspan='10'><textarea name='".$txt3StVar."' cols=40 rows=15 wrap=soft style='width:800px; height:100px; overflow:yes;'>$additionalComments</textarea></td></tr>";
//==============and now for page 2: ==========
$arrayEvaluator = array();
$tableName = $_SESSION['tableName'];
$staffName = $_SESSION['staffName'];
$arrayEvaluator = $_SESSION['arrayEvaluator'];
$index = sizeof($arrayEvaluator);
switch($tableName)
{
case "evalStaff":
$tableTag = "St";
... tag for evalAlternate="Al"
..........
then run through the arrayEvaluator array:
for($i=0;$i<$index;$i++)
{//for $i BEGIN
$txtVar1 = "txt1St".str_replace(", ","_",$staffName)."0".str_replace(", ","_",$arrayEvaluator[$i]);
$txtVar2 = "txt2St".str_replace(", ","_",$staffName)."0".str_replace(", ","_",$arrayEvaluator[$i]);
$txtVar3 = "txt3St".str_replace(", ","_",$staffName)."0".str_replace(", ","_",$arrayEvaluator[$i]);
$txtVar1 = $_POST[$txtVar1];
$txtVar2 = $_POST[$txtVar2];
$txtVar3 = $_POST[$txtVar3];
$sql1 = "UPDATE evalStaff SET pt1Comments='a$txtVar1', pt2Comments='$txtVar2', additionalComments='$txtVar3' WHERE staffName='$staffName' AND evaluatorName='$arrayEvaluator[$i]'";
$resultSet1 = $dbObj->query($sql1);
}//for $i END
-- that is it! hope this email isn't too time consuming; just wanted to show you how it played out - thx for your help!