37 users online (1 members and 36 guests)  


  Results 1 to 4 of 4

Related

  1. Input and Output computation    Forum: Javascript Forum
    Replies: 0
  2. form input changes textarea output    Forum: Javascript Forum
    Replies: 1
  3. html form data output    Forum: HTML Forum
    Replies: 1
  4. Perl Script Text Output? (w3c validator)    Forum: CGI Perl Forum
    Replies: 0
  5. Weird output on resizing images..    Forum: PHP Forum
    Replies: 11
  1. #1
    Blelisa's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Feb 2004
    Posts
    26

    Can you have two output destinations on one asp page?

    Hello all,

    I am trying to have one asp page with a form that when the submit button gets press one field goes to a emailresult.txt and all the reset ot the info from the form goes to my reading.txt. Is this possible?

    Thanks in advance for your help
    Lisa

  2. #2
    yoemanspiffy's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Aug 2006
    Posts
    28

    Re: Can you have two output destinations on one asp page?

    Please elaborate a little.

    Are you saying that you want to physically write the data into two different locations, or that you wand to redirect the page to two different locations. Both are possible.

    If you are going to simply write the data. Just have your code do first the one, then the other.

    If you are looking for redirect, there are a couple of ways you can do it: javascript, frames, etc.

    YM

  3. #3
    Blelisa's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Feb 2004
    Posts
    26

    Re: Can you have two output destinations on one asp page?

    I have a form on my asp page.
    The form collection 10 pieces of data from the visitor. The first 9 peieces of info I am sending to my reading.txt file. I have accomplished this with my <form name="license_input" method="post" action="license_action.asp">.

    Now the last bit of info I gathered from my visitor I want to send to a different file, my email1.txt file. I'm sure I can do this with writing it into another form however I don't want two submit buttons.

    Does that make any sense???

  4. #4
    yoemanspiffy's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Aug 2006
    Posts
    28

    Re: Can you have two output destinations on one asp page?

    Sorry for the dalay, spent some time in the land of the ill:

    <%
    function WriteToFile(FileName, Contents, Append)
    on error resume next
    if Append = true then
    Mode = 8
    else
    Mode = 2
    end if
    set FSO = server.createobject("Scripting.FileSystemObject")
    set TEXTFILE = FSO.OpenTextFile(FileName, Mode, True)
    TEXTFILE.Write Contents
    TEXTFILE.Close
    set TEXTFILE = nothing
    set FSO = nothing
    end function
    %>
    <%
    if request.form("field_submit") = 1 then
    strFieldInfoONE = "Zero: " & request.form("field_zero") & VbCrLf & "One: " & request.form("field_one") & VbCrLf & "===EOR==="
    strFieldInfoTWO = "Two: " & request.form("field_two") & VbCrLf & "===EOR==="

    call WriteToFile("F:\WEBDEV\SANDBOX\WriteFile\One.txt", strFieldInfoONE & VbCrLf, true)
    call WriteToFile("F:\WEBDEV\SANDBOX\WriteFile\Two.txt", "Two: " &strFieldInfoTWO & VbCrLf, true)
    'Put your redirect or thank you text here
    %>
    Thank you.
    <%
    else
    %>
    <form action="TEST.ASP" method="Post">
    <input type="hidden" value="1" name="field_submit">
    Zero:<input type="text" name="field_zero" value="Initial Field Data"><br>
    One: <input type="text" name="field_one" value="First Field Data"><br>
    Two: <input type="text" name="field_two" value="Second Field Data"><br>
    <input type=submit>
    </form>
    <%
    end if
    %>

    Basically, you create a function to write the file. Then call the file twice with different data and filename each time. Let me know if you need a walkthrough.
    YM



Tags for this Thread