Results 1 to 5 of 5

Thread: Query strings...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Unhappy

    Hello,

    I am having a real hard time to understand query strings!!

    Currently I pass data/variables from one page to the next using hidden inputs.
    This works 100%, but I'm running into some trouble with it now. What I want to do
    is send an email address field from page1 to page2, so that I can then use that variable(email)
    in page2, in sql statement for example.

    Can someone please give me some simple example code - I'm sure I'll then be
    able to figure it out.

    Thanks,
    T

  2. #2
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    LoCal
    Posts
    280
    I'm not sure I understand completely...

    You're trying to send an variable (that holds the email address) from one page to the next...

    If you're using forms...
    Code:
    '// In page 1
    
    <form name="whatever" action="post" method="page2.asp">
         <Input Type="text" name="emailaddress" size="50">
         <Input Type="submit">
    </form>
    
    '// In page 2
    
    <html>
    <p>The email you entered was: <%=Request.Form("name")%></p>
    </html>
    If you passed the data in a querystring (which I don't think you are in this case) you would reference the variable as:
    Code:
    <html>
    <p>The email you entered was: <%=Request.QueryString("name")%></p>
    </html>
    Basically the difference is that if you pass things from a form (using POST) they are in the Request.Form collection and if you use GET (like a querystring) then they are in the Request.QueryString collection.

    Hope this helps...
    Achichincle

    VB6 (VSEE SP5, W2KPro)
    ASP
    HTML

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Wink OK, now I'm REALLY lost!!

    Maybe I didn't explain properly or what I want to do is NOT query string.

    I basically want to achieve something like this forum for instance - look in the url - they send some info from one page to the next.

    http://forums.vb-world.net/showthrea...threadid=59054

    The email address which I want to send to the next page is not entered in a input box. I read this from my db. I suppose I now can put this email (which I just read from db) into a input/hidden input and the post it, but I am trying to learn some other stuff - "querystrings" , for now!!

    Thanks,
    T

  4. #4
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    LoCal
    Posts
    280
    Ok. Sorry, I didn't understand what you were trying to do.


    To use querystrings just call the page you want and append the querystring to it...

    Code:
    <html>
    
    <p>Clicking on this link will pass the email [email protected] to emailprocess.asp</p>
    
    <a href="[email protected]">Click here</a>
    
    </html>
    Does that make sense? You basically add the key-value pairs to the url...

    somepage.asp?variable1=value1&variable2=value2&variable3=value3...

    You can do this in your ASP pages by doing stuff like...

    <a href="process.asp?<%=variable1%>=<%=value1%>">Click here</a>

    (Where variable1 and value1 are variables)

    The information you pass this way will then be in the Request.QueryString collection... which means that you to get the values you:

    Code:
    vEmail = Request.QueryString("email")
    Hopefully that's more on target than last time...
    Achichincle

    VB6 (VSEE SP5, W2KPro)
    ASP
    HTML

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Talking

    Thank you VERY much. I'm going to give it a try!!

    T

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