In case 1, all of the hidden fields are being sent to the cgi script (along with any non-hidden ones), so I don't know that you need to send anything else.
In case 2, I would guess that all that's happening is the the page is being submitted, with whatever fields are defined on that form (if any).
I would be curious as to what the openPage and doSubmit functions do.
A reset button never calls a script, it simply resets all field values to the original values. It's used to clear a form and start over.
How a cgi script works can be a long discussion, but I can give you a very abbreviated and simplified version.
First let me explain that CGI stands for Common Gateway Interface. It doesn't describe the language the program is written in, just the way the program interacts with the browser.
Here's what happens when a web page form is submitted:
All text fields, hidden fields, checkboxes, etc. in the form
have their values "encoded" so that spaces and special characters are converted to normal characters (for example, space is converted to %20). This is a holdover from times when special characters caused more problems than they do now.
The field names and values are put togeter into a string, with the format: name=value&name=value&name=value
The program specified in the action clause is called. The string of names and values is passed to the program (how isn't really important for this simple discussion).
The program "takes apart" the string of names and values, and uses those to do whatever it needs to do. This could be sending an email, updating a database, creating a new page, or almost anything else. The main thing to remember is that all this is done on the SERVER, not on your PC. A cgi progam cannot directly affect your PC.
The program must then send something back to the browser that it understands. This could be an image, a web page, a command to go to another web page, or a few other things.
That's the really short version of CGI.
Tracy Dryden
tracy@bydisn.com
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.