[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

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?
0
mwhuen
Asked:
mwhuen
  • 2
  • 2
1 Solution
 
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
 
mwhuenAuthor Commented:
i think this method is better though i haven't try out.
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now