Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 09:52 AM
Mr Typhoon
Guest
 
Posts: n/a
Default 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?
  #2  
Old July 19th, 2005, 09:52 AM
Aaron Bertrand - MVP
Guest
 
Posts: n/a
Default Re: How to use Posted values

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" <anonymous@discussions.microsoft.com> wrote in message
news:025501c3b83f$022649e0$a301280a@phx.gbl...[color=blue]
> 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?[/color]


  #3  
Old July 19th, 2005, 09:52 AM
Tony Archer
Guest
 
Posts: n/a
Default Re: How to use Posted values

> I'm getting dizzy just reading your narrative, never mind trying to guess
at what your[color=blue]
> code looks like.[/color]

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>



  #4  
Old July 19th, 2005, 09:52 AM
Dave Anderson
Guest
 
Posts: n/a
Default Re: How to use Posted values

"Tony Archer" wrote:[color=blue]
>
> x = cint(request.form("x"))[/color]

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.


  #5  
Old July 19th, 2005, 09:52 AM
Tony Archer
Guest
 
Posts: n/a
Default Re: How to use Posted values

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" <GTSPXOESSGOQ@spammotel.com> wrote in message
news:OBKtpsEuDHA.2520@TK2MSFTNGP10.phx.gbl...[color=blue]
> "Tony Archer" wrote:[color=green]
> >
> > x = cint(request.form("x"))[/color]
>
> I'm not sure what happens in VBScript, but I suspect this is the culprit.[/color]
If[color=blue]
> 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.[/color]
Use[color=blue]
> of this email address implies consent to these terms. Please do not[/color]
contact[color=blue]
> me directly or ask me to contact you directly for assistance. If your
> question is worth asking, it's worth posting.
>
>[/color]


  #6  
Old July 19th, 2005, 09:53 AM
Dave Anderson
Guest
 
Posts: n/a
Default Re: How to use Posted values

"Tony Archer" wrote:[color=blue]
>
> I wasn't the original poster.[/color]

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.


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles