Strange... it's working this morning. 😃
But just so that you know, the concept is that a set of corrective actions are entered into a holding table until the entry and plan of action are "approved". The form presents all the records in the the holding table with the ability to click a radio button for approval. Then the form is proceesed all the entries that are "approved" are entered into the "active" table and deleted for the holding table. The form has to be dynamic in the sense that the data in the source table is always changing, yet I had to "grab" the correct record by a dynamic field name...
Initially I run a query:
[CODE]$resultCA = mysql_query("
SELECT *
FROM $tableSource
ORDER by for_id
",$db);
$row = mysql_fetch_array($resultCA);[/CODE]
I set up the form and later with table layout statments:
echo "<form method=post action=$PHP_SELF enctype='multipart/form-data'>\n";
The do/ while loop with index++ allows me to create a "unique" filed name on the fly...
So $for_ob1, $for_ob2, $for_ob3....
do { $for_obStr = for_ob.$index;
I assigned the source table data to this unique field, do a printf of the some of the values along with the radio buttons and end with loop.
echo "<input type=hidden name=\"$for_obStr\" value=\"$row[11]\">\n";
$index++;
$index_count++;
} while ($row = mysql_fetch_row($resultCA));
Now using the index_count value, I can do another loop to process the "approved" records...
for ($index = 0; $index <= $counter; $index++) {
$for_obvalue = ${'for_ob'.$index};
if ($Approvedvalue == '-1')
{
mysql_query( "INSERT INTO $table (
for_ob
) VALUES (
'$for_obvalue'
)");
} // end of If Approved
} // end of For loop
I cleared out two and a half tons of other fields names and values for readability, but it seemed to be straight forward and I couldn't see where the value would be truncated. Usually that happens if the value isn't in quotes, but I had done so.
Anyways, I fired everything up and it is working as expected. Maybe the server cached an earlier version? Whatever, glad it's working and I can move on to the next "problem"....
ron