how would one using a simple form write text to a page forever,until the page with the text in is deleted.
thanks in advance.
scroots
you'd have to use the file system object.
Are you writing to a text file, html file, etc.?
Let me know, in the mean time I'll write you a good example of writing stuff to a text file.
~Quack
Or, you can check out the examples at:
http://www.w3schools.com
They should get you started !
But....
Make sure that the web server has write permissions enabled on the folder containing the file. Or less you'll be plegued with access denied errors.
it would be written to a html file .
thanks everyone.
scroots
Sorry scroots, completely forgot about my promise....
as promised, here's a simple example of how to write to an html file... (actually - this creates the file...)
<%@Language=VBScript%>
<%
Set fso = Server.CreateObject("Scripting.FileSystemObject")
set fs = fso.CreateTextFile("FULL_PATH_TO_YOUR_FILE", true)
fs.writeline("<html>")
fs.writeline("</html>")
fs.Close
set fs = nothing
set fso = nothing
%>
Hope this gives you some insight ... althought I'm sure you may have figured all this out already.
~Quack
Hey, if you want to add text to an exisiting file, change:
CreateTextFile("FULL_PATH_TO_YOUR_FILE", True)
to
OpenTextFile("FULL_PATH_TO_YOUR_FILE")
If you have more questions, post and we'll help :D
~Quack
thanks guys i`m a liitle busy at the moment thanks for your replies its for a litle project i`m making.
scroots
got the idea but i need it from a simple form (text area) with a send button.
it will help me learn ASP.
please;) ;)
scroots
Easiest way to do this is just read from the textarea and write it to the file.... it may not be formatted in the nicest looking way, but the output will stay the same...
in the ASP page that you submit your form to, have the line
fs.write(Request.Form("theText")) instead of the fs.writeline statements.
ASP Page
<%@Language=VBScript%>
<%
Set fso = Server.CreateObject("Scripting.FileSystemObject")
set fs = fso.CreateTextFile("FULL_PATH_TO_YOUR_FILE", true)
fs.write(Request.Form("theText"))
fs.Close
set fs = nothing
set fso = nothing
%>
That should do the trick,
let me know if you need any clarification.
~Quack
thank you, i understand now.
thanks
scroots
No problem.
:thumbsup:
~Quack
quack my code i have done doesn`t write to a file or even make a file. could you please help me, my code:
the form page:
<html>
Set fso = Server.CreateObject("Scripting.FileSystemObject")
set fs = fso.CreateTextFile(sMapPath, true)
fs.write(Request.Form("theText"))
fs.Close
set fs = nothing
set fso = nothing
%>
</body>
</html>
Are you getting an error, or what?
it doesn`t create or write to the file.
scroots
i`m testing it on my PC using PWS, my other ASP (counter) script works, so i doubt it is PWS.
scroots
If it's not doing either one (or either), you should *definitely* be getting an error. Are you sure you're looking in the right place?!?