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?
mwhuenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KennyIT Application ExecutiveCommented:
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.
0
mwhuenAuthor Commented:
yes, you understood my question.
but any other solution? if i use your solution above, my cgi program is too long!
0
BrainMasterCommented:
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.
0
KennyIT Application ExecutiveCommented:
I think the most appropriate way of doing it would be to have most of the info in a html file, and get your program to read it, make necessary changes/additions and then write it to the file and screen as I said above. If done correctly, it would just be a few lines long.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mwhuenAuthor Commented:
i think this method is better though i haven't try out.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.