POST

Discussion in 'ASP General' started by paulmitchell507, Jul 30, 2008.

  1. I have a simple SQL query that is run inside a asp page. I would
    normally display the results using the response.write("my name is: " &
    name) if I wanted the output displayed. On this occasion I want to
    post the results to another .asp page. How do I get the "name" field
    into Request.Form("name") that I need to pass to the next .asp page?
    paulmitchell507, Jul 30, 2008
    #1
    1. Advertising

  2. paulmitchell507 wrote:
    > I have a simple SQL query that is run inside a asp page. I would
    > normally display the results using the response.write("my name is: " &
    > name)

    Err ... the parentheses are not needed unless you are using javascript

    > if I wanted the output displayed. On this occasion I want to
    > post the results to another .asp page. How do I get the "name" field
    > into Request.Form("name") that I need to pass to the next .asp page?


    Use a hidden field:
    <form>
    ....
    <input type="hidden" name="name" value="<%=Request.Form("name")%">
    ....
    </form>

    Note: <%= is shorthand for <%Response.Write

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Jul 30, 2008
    #2
    1. Advertising

  3. On Jul 30, 1:36 pm, "Bob Barrows [MVP]" <>
    wrote:
    > paulmitchell507 wrote:
    > > I have a simple SQL query that is run inside a asp page.  I would
    > > normally display the results using the response.write("my name is: " &
    > > name)

    >
    > Err ... the parentheses are not needed unless you are using javascript
    >
    > > if I wanted the output displayed.  On this occasion I want to
    > > post the results to another .asp page.  How do I get the "name" field
    > > into Request.Form("name") that I need to pass to the next .asp page?

    >
    > Use a hidden field:
    > <form>
    > ...
    > <input type="hidden" name="name" value="<%=Request.Form("name")%">
    > ...
    > </form>
    >
    > Note: <%= is shorthand for <%Response.Write
    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.


    Thank you taking the time to reply to my basic question!
    To explain a little further, after I run the SQL, I am left with a
    single value for holiday_ID. I then call the following to pass the
    holiday_ID to another asp file with our any user input
    <form
    method=post
    action='email2.asp'
    name='myform'>

    <input
    type=hidden
    name='myname'
    value="<%=Request.Form("holiday_id")%>">

    </form>

    <script>
    window.onLoad = document.myform.submit();
    </script>

    I am trying to display the holiday_ID in the email2.asp page as I am
    not sure that the holiday_ID is sent. I have put the following on the
    email2.asp page,

    <%
    'declare your variables
    Dim holiday_ID

    'Receiving values from Form, assign the values entered to variables
    holiday_ID = Request.Form("holiday_ID")

    If holiday_ID <>"" Then
    Response.write("No records returned.")
    Else
    Response.Write("my id is:" & holiday_ID)
    End If
    %>

    If I run the app, "my id is" gets displayed but no holiday_ID. It
    would appear that somthing is passed to the email2something.asp page,
    but what?
    I am sure it's obvious, I am not familiar with asp!
    paulmitchell507, Jul 30, 2008
    #3
  4. paulmitchell507 wrote:
    > On Jul 30, 1:36 pm, "Bob Barrows [MVP]" <>
    > wrote:
    >> paulmitchell507 wrote:
    >>> I have a simple SQL query that is run inside a asp page. I would
    >>> normally display the results using the response.write("my name is:
    >>> " & name)

    >>
    >>> if I wanted the output displayed. On this occasion I want to
    >>> post the results to another .asp page. How do I get the "name" field
    >>> into Request.Form("name") that I need to pass to the next .asp page?

    >>
    >> Use a hidden field:
    >> <form>
    >> ...
    >> <input type="hidden" name="name" value="<%=Request.Form("name")%">
    >> ...
    >> </form>
    >>
    >> Note: <%= is shorthand for <%Response.Write
    >>


    >
    > Thank you taking the time to reply to my basic question!
    > To explain a little further, after I run the SQL, I am left with a
    > single value for holiday_ID. I then call the following to pass the
    > holiday_ID to another asp file with our any user input

    <snip>
    > <input
    > type=hidden
    > name='myname' <====
    > value="<%=Request.Form("holiday_id")%>">
    >

    <snip>

    >
    > 'Receiving values from Form, assign the values entered to variables
    > holiday_ID = Request.Form("holiday_ID")


    You called the hidden element "myName", not "holiday_ID"


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Jul 30, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oleg
    Replies:
    0
    Views:
    1,157
  2. Sridhar Hegde
    Replies:
    2
    Views:
    2,517
    Ajeetha Kumari
    Sep 13, 2004
  3. khawar
    Replies:
    2
    Views:
    1,395
    vMike
    Oct 28, 2003
  4. John Dalberg
    Replies:
    8
    Views:
    631
    John Dalberg
    Sep 23, 2004
  5. Vishal
    Replies:
    1
    Views:
    662
    Steve C. Orr [MVP, MCSD]
    Dec 21, 2004
Loading...

Share This Page