in reply to Flat File Sorting Issues

When you go into your decoding routine, you should have a set of names - values... You don't seem to have a NAME tag on the INPUT fields (maybe a transcription oversight). So, in the HTML, I'd have something like this (leaving out all the table stuff for clarity):
<form action="myscript.cgi" method="post"> <input type="hidden" name="action" value="decode"> <input type="text" name="row1" value="3">List of values from row 1 <input type="text" name="row2" value="1">List of values from row 2 <etc...> <input type="submit" value="Chsnge order"> </form>

Then in your CGI script, you just have to check for the presence of the "action" parameter. If it's there, you know to sort the lines based on the new values that were input by the user. (You indicated you knew how to do this, so I'll leave that explanation out...) Then write the file and voila!

There are probably ways to make this more efficient, of course...