Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 26th, 2003, 06:53 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default whats wrong with this code ?

StartDay = Request.QueryString("Start")
Response.Write Request.QueryString("Start")
'StartDay = 5

Response.Write "Open select with name=StartDay<p>"
For Counter = 1 To 31
 If Counter = StartDay Then
   Response.Write "<br>Option value " & Counter & " is <b>[u]Selected</u></b>"
 Else
   Response.Write "<br>Option value " & Counter & ""
 End If
Next
Response.Write "<p>End Select"


this is supposed to work directly without any problems .. but ive no idea whats wrong ... when i give a value like say Start=9 using GET ... it never gives 9 seletced ..
Request.QueryString("Start") is displaying the value 9 ..

it works only if i specify the value of StartDay directly ..

whats wrong with the code ?
 
Old July 26th, 2003, 07:37 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ideas please ..

 
Old July 26th, 2003, 12:42 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hey guys .. somebody do reply ...

 the problem is whenever i use an if .. else statement which deals variables passed from Forms or functions, inside the for .. next loop

i can read the values of these forms & print it inside the For.. Next Loop. but cant perform If.. Else operations on it the result is always false. why is this happpening ?

 
Old July 26th, 2003, 03:54 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Wien, Wien, Austria.
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

I am not sure what you need with this loop, but if you want to create SELECT form element based on the value in querystring, here is the sample code:
Code:
StartDay = Request.QueryString("Start")
Response.Write "<select name=somename>"                              
For Counter = 1 To 31
    If Counter = StartDay Then
        Response.Write "<option value=" & Counter & " selected>" & Counter & "</option>"
    Else 
        Response.Write "<option value=" & Counter & ">" & Counter & "</option>"
    End If
Next 
Response.Write "</select>"
...but the Soon is eclipsed by the Moon
 
Old July 26th, 2003, 04:12 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yea its exactly like my scipt ... i used urs as well .. bu no use
<%
    StartDay = Request("StartDay")
    Response.Write "<select name=StartDay>"
    For Counter = 1 To 31
        If Counter = StartDay Then
            Response.Write "<option value=" & Counter & " selected>" & Counter & "</option>"
        Else
        Response.Write "<option value=" & Counter & ">" & Counter & "</option>"
    End If
    Next
    Response.Write "</select>"
%>

But i never got 'selected' even once when the Request("StartData") ... even though Request("StartDate") is present ..

do help


 
Old July 27th, 2003, 07:46 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Try explicitly converting the startDay to an int.

If Counter = CInt(StartDay) Then




======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================




Similar Threads
Thread Thread Starter Forum Replies Last Post
what's wrong with this code? hertendreef Visual Basic 2005 Basics 0 March 2nd, 2007 10:29 AM
Whats wrong? Agentofnight Beginning PHP 3 April 17th, 2005 04:11 AM
Whats wrong with the GUI display Sandz Java GUI 1 February 5th, 2005 08:28 AM
whats wrong with this code? sand133 VB.NET 2002/2003 Basics 2 September 12th, 2004 10:07 PM
Whats wrong with this code? Thomas82 Classic ASP Databases 6 February 26th, 2004 09:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.