Assignment doesnt assign???

Discussion in 'ASP General' started by Tim Slattery, Mar 3, 2006.

  1. Tim Slattery

    Tim Slattery Guest

    My ASP page contains the following VBScript code:
    <%
    zipCode = Request.Form("zip")
    %> <br>zip: <%= zipCode %>, rf: <%= Request.Form("zip") %>

    When I enter "abc" into the "zip" field on the form, I get the
    following output:

    zip: , rf: abc

    Why doesn't the first statement assign the "abc" string to the
    variable "zipCode"? What am I not seeing?

    --
    Tim Slattery
    MS MVP(DTS)
     
    Tim Slattery, Mar 3, 2006
    #1
    1. Advertising

  2. Tim Slattery

    Mike Brind Guest

    Tim Slattery wrote:
    > My ASP page contains the following VBScript code:
    > <%
    > zipCode = Request.Form("zip")
    > %> <br>zip: <%= zipCode %>, rf: <%= Request.Form("zip") %>
    >
    > When I enter "abc" into the "zip" field on the form, I get the
    > following output:
    >
    > zip: , rf: abc
    >
    > Why doesn't the first statement assign the "abc" string to the
    > variable "zipCode"? What am I not seeing?
    >
    > --
    > Tim Slattery
    > MS MVP(DTS)
    >



    Works fine for me. I get

    zip: abc, rf: abc

    using Windows XP Pro SP2, IIS 5, Firefox 1.5.0.5, IE6 and Opera. 8.51.

    How odd!

    --
    Mike Brind
     
    Mike Brind, Mar 3, 2006
    #2
    1. Advertising

  3. Tim Slattery

    Roland Hall Guest

    "Tim Slattery" <> wrote in message
    news:...
    : My ASP page contains the following VBScript code:
    : <%
    : zipCode = Request.Form("zip")
    : %> <br>zip: <%= zipCode %>, rf: <%= Request.Form("zip") %>
    :
    : When I enter "abc" into the "zip" field on the form, I get the
    : following output:
    :
    : zip: , rf: abc
    :
    : Why doesn't the first statement assign the "abc" string to the
    : variable "zipCode"? What am I not seeing?

    Is this all you have on the page and did you type it here or copy/paste?

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
     
    Roland Hall, Mar 4, 2006
    #3
  4. Tim Slattery

    Tim Slattery Guest

    "Roland Hall" <nobody@nowhere> wrote:

    >"Tim Slattery" <> wrote in message
    >news:...
    >: My ASP page contains the following VBScript code:
    >: <%
    >: zipCode = Request.Form("zip")
    >: %> <br>zip: <%= zipCode %>, rf: <%= Request.Form("zip") %>
    >:
    >: When I enter "abc" into the "zip" field on the form, I get the
    >: following output:
    >:
    >: zip: , rf: abc
    >:
    >: Why doesn't the first statement assign the "abc" string to the
    >: variable "zipCode"? What am I not seeing?
    >
    >Is this all you have on the page and did you type it here or copy/paste?


    There's lots on the page, so *something* there must be non-kosher I
    suppose, even though everything looks OK. Yes, I did copy and past
    this. The line that dumps the values on the page starts with "%>" and
    ends with "<%" because its a debug line that I stuck in the middle of
    server-side code.

    Regardless of what is going on elsewhere, I can't figure out why the
    assignment (apparently) doesn't happen.

    --
    Tim Slattery
     
    Tim Slattery, Mar 6, 2006
    #4
  5. Tim Slattery wrote:
    >
    > There's lots on the page, so *something* there must be non-kosher I
    > suppose, even though everything looks OK. Yes, I did copy and past
    > this. The line that dumps the values on the page starts with "%>" and
    > ends with "<%" because its a debug line that I stuck in the middle of
    > server-side code.
    >
    > Regardless of what is going on elsewhere, I can't figure out why the
    > assignment (apparently) doesn't happen.


    Your best course of action is to create a small test page containing only
    the bits needed to reproduce this particular symptom and post it here.

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Mar 6, 2006
    #5
  6. Bob Barrows [MVP] wrote:
    > Tim Slattery wrote:
    >>
    >> There's lots on the page, so *something* there must be non-kosher I
    >> suppose, even though everything looks OK. Yes, I did copy and past
    >> this. The line that dumps the values on the page starts with "%>" and
    >> ends with "<%" because its a debug line that I stuck in the middle of
    >> server-side code.
    >>
    >> Regardless of what is going on elsewhere, I can't figure out why the
    >> assignment (apparently) doesn't happen.

    >
    > Your best course of action is to create a small test page containing
    > only the bits needed to reproduce this particular symptom and post it
    > here.


    I should have added:
    If you cannot reproduce your symptoms in the small test page, add stuff from
    your problem page until the symptom appears.

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Mar 6, 2006
    #6
  7. Tim Slattery

    Tim Slattery Guest

    Tim Slattery <> wrote:

    >"Roland Hall" <nobody@nowhere> wrote:
    >
    >>"Tim Slattery" <> wrote in message
    >>news:...
    >>: My ASP page contains the following VBScript code:
    >>: <%
    >>: zipCode = Request.Form("zip")
    >>: %> <br>zip: <%= zipCode %>, rf: <%= Request.Form("zip") %>
    >>:
    >>: When I enter "abc" into the "zip" field on the form, I get the
    >>: following output:
    >>:
    >>: zip: , rf: abc
    >>:
    >>: Why doesn't the first statement assign the "abc" string to the
    >>: variable "zipCode"? What am I not seeing?


    Found it. There was a tried-and-true, guaranteed to work ASP file
    being included at the top of this thing. The first statement in that
    file was "option explicit".

    So if I simply "dim" the variable "zipCode", it works fine. The
    server admins apparently have some option set - or not set - so that I
    get just about no ASP error messages, and I had *no* error message for
    this thing.

    --
    Tim Slattery
     
    Tim Slattery, Mar 6, 2006
    #7
  8. Tim Slattery

    Roland Hall Guest

    "Tim Slattery" <> wrote in message
    news:...
    : Tim Slattery <> wrote:
    :
    : >"Roland Hall" <nobody@nowhere> wrote:
    : >
    : >>"Tim Slattery" <> wrote in message
    : >>news:...
    : >>: My ASP page contains the following VBScript code:
    : >>: <%
    : >>: zipCode = Request.Form("zip")
    : >>: %> <br>zip: <%= zipCode %>, rf: <%= Request.Form("zip") %>
    : >>:
    : >>: When I enter "abc" into the "zip" field on the form, I get the
    : >>: following output:
    : >>:
    : >>: zip: , rf: abc
    : >>:
    : >>: Why doesn't the first statement assign the "abc" string to the
    : >>: variable "zipCode"? What am I not seeing?
    :
    : Found it. There was a tried-and-true, guaranteed to work ASP file
    : being included at the top of this thing. The first statement in that
    : file was "option explicit".
    :
    : So if I simply "dim" the variable "zipCode", it works fine. The
    : server admins apparently have some option set - or not set - so that I
    : get just about no ASP error messages, and I had *no* error message for
    : this thing.

    Good catch.

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
     
    Roland Hall, Mar 8, 2006
    #8
    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. Michael Mayer [C# MVP]
    Replies:
    2
    Views:
    2,881
    Andrew Baker
    Apr 15, 2004
  2. aushitha
    Replies:
    0
    Views:
    746
    aushitha
    Apr 30, 2006
  3. nagy
    Replies:
    36
    Views:
    1,015
    Terry Reedy
    Jul 20, 2006
  4. Chris
    Replies:
    34
    Views:
    1,535
  5. Replies:
    3
    Views:
    438
    alex23
    May 27, 2008
Loading...

Share This Page