Results 1 to 7 of 7

Thread: receiving variables

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870

    receiving variables

    <%
    i = 1
    product1 = Request.Form("product" & i)
    %>

    i wanna receive the variable name "product1" by putting "product" and i together.

    The above code tho doesn't work. Any ideas?

    Thanks
    Nick

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Hi nick

    Have you got the Input's inclosed within a form tag, as you need it to be able pass it through and that you submit it ? ie.

    <form name="Form1" Method="GET" Action="Myasppage.asp">
    <Input type="Text" name="Product1">
    <Input type="Submit" value="Post Values">
    </form>

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    i can receive the variable "product1"

    but what i wanna do is put a count in

    <%
    i = 1 to 10
    product & i = Request.Form("product" & i)
    next

    %>

    so that it recieves products 1 to 10 and puts them in variables 1 to 10.

    Is this possible?

    Nick

  4. #4
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Originally posted by nswan
    i can receive the variable "product1"

    product & i = Request.Form("product" & i)

    the above is your problem, as you cannot ass concatenate to make a variable. What I would suggest you do, is store the variables into an array ie.


    <%
    Dim Products

    ReDim Products(9)
    i = 1 to 10
    products(iflag -1) = Request.Form("product" & i)
    next

    %>
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    that would be cool.....

    but the

    Request.Form("product" & i)

    doesn't seem to work. It just request "product"

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    i tell a lie.....it works okay!!

    Thanks mate

  7. #7
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    np, was just about to reply with there shouldn't be anything wrong with that code
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

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