silly ASP POST method bug

R

ramata

This is really strange for me.

I have a demo.asp page, that can't pass hidden value "mr progrramer" to
itself using POST method. Only "mr" is passed.

I created a second asp file demo1.asp and passed "mr programmer" and whole
string (include space b/w mr and programmer was passed successfully).

The code for demo.asp is

<%
name = request.Form("name")
response.Write "hello " & request.Form("name")

' if name is empty then store some string with space in it
' problem is the word before space 'mr' is passed, but 'programer' is not
passed
if len(name)=0 then
name = "mr programmer"
end if
%>

<form name="test" action="demo.asp" method="post">
<input type=hidden name="name" value=<%=name%> >
<INPUT type="submit" value="Demo" name="Submit">
</form>

-----------------
code for demo1.asp

<h1>call demo</h1>
<form name="test" action="demo.asp" method="post">
<input type=hidden name="name" value="mr programmer" >
<INPUT type="submit" value="Demo" name="Submit">
</form>
 
T

Tom Kaminski [MVP]

ramata said:
This is really strange for me.

I have a demo.asp page, that can't pass hidden value "mr progrramer" to
itself using POST method. Only "mr" is passed.

I created a second asp file demo1.asp and passed "mr programmer" and whole
string (include space b/w mr and programmer was passed successfully).

The code for demo.asp is

<%
name = request.Form("name")
response.Write "hello " & request.Form("name")

' if name is empty then store some string with space in it
' problem is the word before space 'mr' is passed, but 'programer' is not
passed
if len(name)=0 then
name = "mr programmer"
end if
%>

<form name="test" action="demo.asp" method="post">
<input type=hidden name="name" value=<%=name%> >

You're missing quotes:
<input type=hidden name="name" value="<%=name%">
 
R

Roland Hall

in message
: : > This is really strange for me.
: >
: > I have a demo.asp page, that can't pass hidden value "mr progrramer" to
: > itself using POST method. Only "mr" is passed.
: >
: > I created a second asp file demo1.asp and passed "mr programmer" and
whole
: > string (include space b/w mr and programmer was passed successfully).
: >
: > The code for demo.asp is
: >
: > <%
: > name = request.Form("name")
: > response.Write "hello " & request.Form("name")
: >
: > ' if name is empty then store some string with space in it
: > ' problem is the word before space 'mr' is passed, but 'programer' is
not
: > passed
: > if len(name)=0 then
: > name = "mr programmer"
: > end if
: > %>
: >
: > <form name="test" action="demo.asp" method="post">
: > <input type=hidden name="name" value=<%=name%> >
:
: You're missing quotes:
: <input type=hidden name="name" value="<%=name%">

watch those typos:
<input type="hidden" name="name" value="<%=name%>" />

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

Roland Hall

: This is really strange for me.
:
: I have a demo.asp page, that can't pass hidden value "mr progrramer" to
: itself using POST method. Only "mr" is passed.
:
: I created a second asp file demo1.asp and passed "mr programmer" and whole
: string (include space b/w mr and programmer was passed successfully).
:
: The code for demo.asp is
:
: <%
: name = request.Form("name")
: response.Write "hello " & request.Form("name")
:
: ' if name is empty then store some string with space in it
: ' problem is the word before space 'mr' is passed, but 'programer' is not
: passed
: if len(name)=0 then
: name = "mr programmer"
: end if
: %>
:
: <form name="test" action="demo.asp" method="post">
: <input type=hidden name="name" value=<%=name%> >
: <INPUT type="submit" value="Demo" name="Submit">
: </form>
:
: -----------------
: code for demo1.asp
:
: <h1>call demo</h1>
: <form name="test" action="demo.asp" method="post">
: <input type=hidden name="name" value="mr programmer" >
: <INPUT type="submit" value="Demo" name="Submit">
: </form>

ramata...

to add, try not to use reserved names.

strName tells the type of variable and is not a reserved word. Some
reserved words will cause problems in your code, although not in this one.

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

Bob Lehmann

It is true that in HTML there are no reserved words for attribute values.
However, using attribute values like "name" for the name attribute can cause
problems if you are using JavaScript to access those attributes.

Ever tried naming a submit button "submit"?

Bob Lehmann
 
B

Bob Lehmann

but scripting aside, the form will still be submittable in full.
uhhh... I'm pretty sure that's what I said.

Thanks for snipping the part that framed my response.

Bob Lehmann
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top