Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - check the value in two variables
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

check the value in two variables

 Post Reply Post Reply
Author
William Rendell View Drop Down
Groupie
Groupie
Avatar

Joined: 19 June 2002
Status: Offline
Points: 55
Post Options Post Options   Thanks (0) Thanks(0)   Quote William Rendell Quote  Post ReplyReply Direct Link To This Post Topic: check the value in two variables
    Posted: 23 October 2008 at 9:25am
Hello
 
I am wondering if anyone can help me?
 
here is the code I am trying to get to work
 
<% if session("rn") = request.form("code") then
response.write("match")
else
response.write("no match")
end if %>
 
Both session("rn") and request.form("code") contain a number, what I am trying to achieve is if the two equal each other then it writes "match" if they dont equal the same then write no match.
 
My trouble is I never get a match even when I know both session("rn") and request.form("code") contain the same number! I have verified this by writing out them both on screen and can confirm they are the same, what am I doing wrong?
 
Thanks in advance
 
 
Will
Back to Top
socialanimal View Drop Down
Newbie
Newbie
Avatar

Joined: 14 October 2007
Location: Leeds, UK
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote socialanimal Quote  Post ReplyReply Direct Link To This Post Posted: 23 October 2008 at 5:37pm
Try wrapping cInt() round the variables to force them as integers. When bringing back from a request form variable, values are generally treated as strings.  
Back to Top
shakir View Drop Down
Groupie
Groupie


Joined: 08 November 2007
Location: Saudi Arabia
Status: Offline
Points: 41
Post Options Post Options   Thanks (0) Thanks(0)   Quote shakir Quote  Post ReplyReply Direct Link To This Post Posted: 31 December 2008 at 2:19pm
<% if cint(session("rn")) = cint(request.form("code")) then
response.write("match")
else
response.write("no match")
end if %>

will work
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.