Assignment doesnt assign???

T

Tim Slattery

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?
 
M

Mike Brind

Tim said:
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?


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!
 
R

Roland Hall

: 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
 
T

Tim Slattery

Roland Hall said:
: 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.
 
B

Bob Barrows [MVP]

Tim said:
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.
 
B

Bob Barrows [MVP]

Bob said:
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.
 
T

Tim Slattery

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.
 
R

Roland Hall

:
: >
: >>: >>: 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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top