Lately i've been reading a book on php and i've been asking one question and finding no answer in the book. So i turn here.
I was wondering what (for instance the url at the top of this page that i'm writing this forum in) http://www.phpbuilder.com/forum/post.php3?num=1 means.
Breaking it down i know that the http://www..com/forum/ is. What i dont inder stand is what the post.php3?num=1 is. I know that you can call a switch with that type of syntax, but for me that url would change to post.php3, and would leave off the ?number=1. I have also seen url's like www.something.com/page.php?num=1&id=9994&thread=9994. What does the &id... mean? I was thinking maybe it was just setting var's for that page, but i'm not sure so i'll leave it up to you guys.

    passing data via GET method (as opposed to POST). arranged in [key]=[value] paings.

    separated by &, started with ?

    so, [url]?[var1]=[var1_value]&[var2]=[var2_value]

    must only be valid url chars, no spaces. you use php's urlencode($string) to encode a string

    the %20 you'll notice is a space. url-encoding starts with a %, and the next two digits are the ascii character representation.

    in php, the vars are set in the
    $HTTP_GET_VARS['var1'], $HTTP_GET_VARS['var2'] or, just as $var1, $var2

    the receiving script/page interprets the variables as necessary.
    there is a max length to the url, and they can be seen in the person's history, so sensitive data should be passed with POST..

    there's your little tutorial 🙂
    blake

      ok, now I have a simple question.

      I know about query strings, and so forth but Ive seen the following and Ive always been curious as to how it works.

      this is what Im used to seeing, and doing myself.
      domain/filename?querystring

      but Ive seen this quite regularly
      domain/?querystring.

      How does that work, since a filename has not been specified?

        i'm guessing the query string will go to the index file there.

        probably index.htm or index.php

          yeah,
          thats the only thing I could figure as well. so,

          www.domain.com/?id=1
          goes to index.* with the query string and

          www.domain.com/dir1/dir2/dir3/?id=1
          goes to /dir3/index.* and sends it the query string.

          I guess thats how it works.

            Write a Reply...