Forums
This topic is locked
Request.form("value") not working with If Else
Posted 15 Mar 2002 17:13:00
1
has voted
15 Mar 2002 17:13:00 Tom Devins posted:
Hi,I'm trying to use a Request.form("value" with an IF/Else Statement to determine which sql string I'm using.
The code is as follows:
*******************************************
strRegion = Request.form("region"
if strRegion = "North" Then
Recordset1.Source = "SELECT * FROM tourism_collection WHERE area = 'North';"
else
Recordset1.Source = "SELECT * FROM tourism_collection
end if
I've also tried this....
if Request.form("region" = "North" Then
Recordset1.Source = "SELECT * FROM tourism_collection WHERE area = 'North';"
else
Recordset1.Source = "SELECT * FROM tourism_collection
end if
*******************************************
The "logic" I'm using is from some basic ASP pages I hand coded last year using Option Explicit/Dim's/etc so I'm a little lost with UD's lack of these features.
Any help/suggestons would be appreciated.
Also, the form is on the same page as the searchresults page (sql statements) so would this be causing a problem.
Thanks.
Replies
Replied 15 Mar 2002 18:19:40
15 Mar 2002 18:19:40 Michael Rudge replied:
are you posting the page to itself? Is it's action set to go to the same page? that maybe it.
Also you may rework the logic alittle assuming there are other regions to be:
strRegion = Request.Form("region"
if strRegion <> "" then
Recordset1.Source = "SELECT * FROM tourism_collection where area = 'strRegion';"
Michael Rudge
Also you may rework the logic alittle assuming there are other regions to be:
strRegion = Request.Form("region"
if strRegion <> "" then
Recordset1.Source = "SELECT * FROM tourism_collection where area = 'strRegion';"
Michael Rudge