Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    write to page permantately

    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
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    344
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Or, you can check out the examples at:

    http://www.w3schools.com

    They should get you started !
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #4
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    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.
    OracleGuy

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    it would be written to a html file .
    thanks everyone.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Posts
    344
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Last edited by QuackHead; 07-03-2002 at 03:00 PM.

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Posts
    344
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

    ~Quack

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks guys i`m a liitle busy at the moment thanks for your replies its for a litle project i`m making.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #9
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #10
    Regular Coder
    Join Date
    Jun 2002
    Posts
    344
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...

    Html page
    Code:
    <form action="YOUR_ASP_PAGE.ASP" method="post">
    <textarea rows="10" cols="30" name="theText"></textarea>
    <br>
    <input type="submit">
    </form>
    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
    Code:
    <%@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
    Last edited by QuackHead; 07-08-2002 at 08:54 PM.

  • #11
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you, i understand now.

    thanks

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #12
    Regular Coder
    Join Date
    Jun 2002
    Posts
    344
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No problem.



    ~Quack

  • #13
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    </head>

    <body>
    <form action="myasp.asp" method="post">
    <textarea rows="10" cols="30" name="theText"></textarea>
    <br>
    <input type="submit">
    </form>

    </body>

    </html>


    the other page (myasp.asp):
    <html>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    </head>

    <body>
    <%@Language=VBScript%>
    <%
    Set fso = Server.CreateObject("Scripting.FileSystemObject")
    set fs = fso.CreateTextFile("my.txt", true)
    fs.write(Request.Form("theText"))
    fs.Close
    set fs = nothing
    set fso = nothing
    %>

    </body>

    </html>

    the first page does the form action (sends to myasp.asp) but myasp.asp does not write to a file.
    can anyone help?

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #14
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That worked fine for me - however I had to map the path to the directory on my server (database) that has write permissions.:

    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    </head>

    <body>
    <%@Language=VBScript%>
    <%

    sMapPath = Server.MapPath("\")
    sMapPath = Mid(sMapPath, 1, InStrRev(sMapPath,"\")-1) & "\database\my.txt"

    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?
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #15
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    it doesn`t create or write to the file.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •