[ back to toc ]

Form Mail

Date: 2002/01/28 08:03

Q:
I am using a form mail script and every time i click on submit it makes me
download something why is that is that right please ansewer me?? Thanks
A:
When you press the submit button the client sends the form data to the
server and the server sends back and answer "page". An http answer that
the web server sends to the browser can be HTML, GIF, JPG or any other
type of file. The only requirement is that the server tells the browser
what type the file is, and thus the browser can decide how to handle the
data.

In your case the script that works up the form data and generates the
answer page has to "print" to the STDOUT (I assume you use Perl)

print "Status: 200 OK\nContent-Type: text/html\n\n";

before the HTML page is printed. If this is not done (and I assume this
being the case) the browser will not be able to figure out that this
answer is an HTML page and as a best tells you to save the data to disk
and after that do with it what you want.

Regards,
Peter

[ back to toc ]