Results 1 to 6 of 6

Thread: Whats wrong with this Code Please

  1. #1

    Thread Starter
    Addicted Member sotusotusotu's Avatar
    Join Date
    Aug 2001
    Location
    Plymouth, England
    Posts
    158

    Whats wrong with this Code Please

    I have a a page with a text box called NumberEntered that goes to NumberEntered.asp.

    Can anyone please tell me whats wrong

    Heres the code for NumberEntered.asp

    ---------------------------------------------------------------------------------


    <%

    Dim NumberEntered
    NumberedEntered = Request.Form ("NumberEntered")

    If NumberEntered = 1 Then
    Goto 1
    Else
    Goto 2
    End If

    1:
    Response.Write "You Entered <b>1</b>"

    2:
    Response.Write "You Entered <b>2</b>"

    %>

    -------------------------------------------------------------------------------

    thanks
    Living a Lie, Timmy

  2. #2
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196
    Could yo ube a bit more specific?
    Is the form with the textbox using the POST method
    Code:
    <%
    
    If clng(Request.Form ("NumberEntered"))=1 Then
       Response.Write "You Entered <b>1</b>"
    Else
       Response.Write "You Entered <b>2</b>"
    End if
    
    %>

  3. #3

    Thread Starter
    Addicted Member sotusotusotu's Avatar
    Join Date
    Aug 2001
    Location
    Plymouth, England
    Posts
    158
    Yes there is a text box with a post method.

    thanks
    Living a Lie, Timmy

  4. #4

    Thread Starter
    Addicted Member sotusotusotu's Avatar
    Join Date
    Aug 2001
    Location
    Plymouth, England
    Posts
    158
    Sorry. I should have said that i wanted someone to explain to me the Goto command.

    Thanks.
    Living a Lie, Timmy

  5. #5
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196
    I've never used the goto command in ASP.
    It's considered bad practice, because it create speghetti(sp?) code
    Stick to "if"s or "select case"s
    I take it that if you have a value of 1 then both statements are appearing. yes?

  6. #6

    Thread Starter
    Addicted Member sotusotusotu's Avatar
    Join Date
    Aug 2001
    Location
    Plymouth, England
    Posts
    158
    No i just get an error.

    It doesn't work at all.
    Living a Lie, Timmy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width