Link to home
Start Free TrialLog in
Avatar of mwhuen
mwhuen

asked on

post and write a html at the same time

in my cgi program, I want to create xxx.html and at the same time I want to post this xxx.html in this cgi program, how can i do?
Avatar of Kenny
Kenny
Flag of Malaysia image

If I understand correctly, what you want to do is to make your cgi create a HTML file, and then display it's contents on screen.

Just print the info into a html file and also into the browser (no file handle).

Something like this :

print "Content-type: text/html","\n\n";      # MIME header

print HTMLFILE $String;
print $String;

and repeat it this way for all the data in the file.
Avatar of mwhuen
mwhuen

ASKER

yes, you understood my question.
but any other solution? if i use your solution above, my cgi program is too long!
another idea is that you can create the html file then when that's done send a redirect to the broswer by sending a
"Location:<new http file>\n\n" as a http header.
ASKER CERTIFIED SOLUTION
Avatar of Kenny
Kenny
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mwhuen

ASKER

i think this method is better though i haven't try out.