fyanym
04-08-2005, 04:25 AM
after i fill in a form (asp), i want to save it as html file after i click submit button. what can i do?
|
Click to See Complete Forum and Search --> : save as html file fyanym 04-08-2005, 04:25 AM after i fill in a form (asp), i want to save it as html file after i click submit button. what can i do? buntine 04-08-2005, 04:58 AM Let me just make sure I understand. You want to grab a bunch of data from the user and then use it to generate an HTML file? If so, you can use the FileSystemObject to create and populate a text-based file. I will wait for your reply before I go into any particular detail. Regards. fyanym 04-08-2005, 05:02 AM yup, i have a bunch of data and i need to generate an html file after i click a button buntine 04-08-2005, 05:56 AM Ok. So, we can use the FileSystemObject to do this. First create the new file. Set fso = Server.CreateObject("Scripting.FileSystemObject") Set textStreamObject = fso.CreateTextFile("fileName.html", true, false) '| Create the file. Then populate it with the HTML. There are two key functions here. writeLine() writes a string and a new-line character to the output. And write() simply writes passed string to the output without including the new-line character. textStreamObject.WriteLine("<html>") textStreamObject.WriteLine("<head>") '| etc, etc. '| Example to print a value from the form. textStreamObject.WriteLine(Request.Form("formFieldName")) textStreamObject.Close '| This is important. The file will not be written if you don't call this. Set textStreamObject = Nothing I will leave the specifics of the actual HTML content up to you for the moment. But this help you get started. Regards. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |