Link to home
Start Free TrialLog in
Avatar of youngman072798
youngman072798

asked on

"CREATING" HTML using CGI

I have created a form and am trying to PERMANENTLY save the data as a NEW HTML document.  Example -  14 people fill in information into a form ( i.e. Name, Question Responses, etc...) and I am trying to PERMANTENTLY save their answers in HTML format so the other 13 people can view the responses in a readable format.  The names of the saved file may be answer01.html, answer02.html,....  I know the 14 people and can use a pick list referencing an array to predetermine the saved file name.  

Is this possible using JavaScript or CGI!!!
Can a person RE-SUBMIT their answers and successfully override the current file of the same name that aready exists?
Can I control the format of the saved file?
Avatar of samasan
samasan

Can you be more specific?  Will the CGI implementation be in Perl, C, sh?  You can do it and it is relatively straight forward, but I need to know which language or which OS this will be on.
Avatar of sybe
Not with Javascript.

I would do what you want by saving the information in a database and use a cgi to get it out.
You can use CGI to do what you want, not javascript. Since CGI is just a program that runs in response to a request from the web, then as long as you can write a program to write the files and read them back it can be done with CGI.

Personally, I'd save it the results to files as you suggest, rather than a database, because it's a little easier and it sounds like it fits your needs.

Actually, I'd probably save all responses to a single HTML file that your users can view them at once, and each new update would overwrite only the relevant section of the HTML file. But I'd do it in perl, which is really good at this sort of text manipulation. If you don't know perl, separate files is probably easier.
There are a number of bulletin board type Perl apps available on the Web would might suit your purpose. It would mean you'd only have to get Perl and not have to learn it
With Standard HTML you could use a form with the POST methods to write to a file
As far as "resubmitting" and overwritting files, that will require some sort of username/password scheme. "Controlling the format of the file" will require some extensive parsing, if you are hoping to filter out selective HTML, for example. Both of these add a lot of complexity to your original request, which is fairly simple, but will also be fairly open to abuse.

A simple perl cgi script is enough for the first part. Perl could also handle the authentication and parsing, but, it wouldn't be so simple anymore. I personally think a small database (i.e. one file on ethe server) would be easier than using 14 html pages.





ASKER CERTIFIED SOLUTION
Avatar of Answers2000
Answers2000

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