Web Analytics Made Easy -
StatCounter write to page permantately - CodingForum

Announcement

Collapse
No announcement yet.

write to page permantately

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    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

    Comment


    • #3
      Or, you can check out the examples at:

      W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.


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

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

      Comment


      • #4
        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

        Comment


        • #5
          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

          Comment


          • #6
            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; Jul 3, 2002, 10:00 AM.

            Comment


            • #7
              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

              Comment


              • #8
                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

                Comment


                • #9
                  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

                  Comment


                  • #10
                    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; Jul 8, 2002, 03:54 PM.

                    Comment


                    • #11
                      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

                      Comment


                      • #12
                        No problem.



                        ~Quack

                        Comment


                        • #13
                          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

                          Comment


                          • #14
                            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. ;)

                            Comment


                            • #15
                              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

                              Comment

                              Working...
                              X