469,312 Members | 2,496 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,312 developers. It's quick & easy.

How to use Posted values

I am having problems on post method.
i have used post method to send my form values to the
same page so in that page (same page) a script will work
to show something on the document but not.I have a problem
when i try to assign the posted value i cant proceed to a
variable.The posted value could not assigned to my
variable.
What can i do to send my values to the same page and
assign the values to my variables which are on the same
page?
Jul 19 '05 #1
5 1891
Can you show some code and point out where the problem is? I'm getting
dizzy just reading your narrative, never mind trying to guess at what your
code looks like.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Mr Typhoon" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
I am having problems on post method.
i have used post method to send my form values to the
same page so in that page (same page) a script will work
to show something on the document but not.I have a problem
when i try to assign the posted value i cant proceed to a
variable.The posted value could not assigned to my
variable.
What can i do to send my values to the same page and
assign the values to my variables which are on the same
page?

Jul 19 '05 #2
> I'm getting dizzy just reading your narrative, never mind trying to guess
at what your
code looks like.


ROFL.

Yes. Here is my best guess:

<form name="BillGates" action="MyFormPage.asp" method="POST">
<%
x = cint(request.form("x"))

if x = 1 then%>
Weeeeee, X is equal to One!<hr>
<%else%>
I'm depressed X != 1<hr>
<%end if%>
<input type=checkbox name=x value=1> This is the checkbox<br>
<input type=submit value="Submit" name=s>

</form>

Jul 19 '05 #3
"Tony Archer" wrote:

x = cint(request.form("x"))


I'm not sure what happens in VBScript, but I suspect this is the culprit. If
the checkbox is not checked (or no POST was made yet), there is no
Request.Form("x").Item for your CInt() call. You may want to use something
similar to this:

vbscript:
If Request.Form("x").Count > 0 Then
x = Request.Form("x").Item/1
Else
x = 0
End If
Response.Write(x)

JScript:
x = (Request.Form("x").Item || 0)/1
Response.Write(x)

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #4
I wasn't the original poster. But you are right, my example code should NOT
have the "cint" there.

I just wrote it on the fly and wasn't thinking much :)
"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
"Tony Archer" wrote:

x = cint(request.form("x"))
I'm not sure what happens in VBScript, but I suspect this is the culprit.

If the checkbox is not checked (or no POST was made yet), there is no
Request.Form("x").Item for your CInt() call. You may want to use something
similar to this:

vbscript:
If Request.Form("x").Count > 0 Then
x = Request.Form("x").Item/1
Else
x = 0
End If
Response.Write(x)

JScript:
x = (Request.Form("x").Item || 0)/1
Response.Write(x)

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.

Jul 19 '05 #5
"Tony Archer" wrote:

I wasn't the original poster.


Indeed. Sorry about that.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by tmb | last post: by
1 post views Thread by John Wright | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.