[ back to toc ]

Form Inside a CGI?

Date: 2001/12/27 11:26

Q:
Hi!

I'm trying to make a CGI script that has a form in it and the subroutine
in it will output the info from the form into either output for the
browser/send the info into a file for later retrival.

Is this possible? I got the form inside the script working, but when I
hit the submit button, it doesn't work.

A copy of the script can be found here:
http://ice.prohosting.com/genotaku/cgi-bin/input.cgi
A:
You actually need two scripts. One that prints the form to the browser and
the other one that works up the data that is sent from the browser to the
CGI script.

These two scripts can be implemented in one file, in one program, as you
intended, but in that case the program has to distinguish between the
initial call to the CGI script to display the form and the form submit.

I recommend that first you generate a static HTML page that contains the
form and write a script that works up the CGI data sent by teh user from
the form and save it in a file and display/print nothing more than "Thank
you".

If that works, and it should then you can go on and modify your code
learning all the way along.

Regards,
Peter

[ back to toc ]