Hi jbob, i didn't thoroughly analyze your code, but did a quick run through it, and i found 2 errors to start of with.
- line 83, the value being echoed into the hidden control's value attribute, has an extra $ sign. I don't think you need the $ sign.
- notice that on line 5 and line 36, you use the mysql_fetch_assoc() on the same result set, if not intended, this means that in your while loop you will loop for 1 less than the actual number of rows in the recordset.
The reason for this being, that you have already extracted a row at line 5, by the call to mysql_fetch_assoc. ie the result handle's pointer has moved 1 step down the recordset.
So you could try to fix this first, then retry and see what comes up next.