--- alternate_dph <[EMAIL PROTECTED]> wrote:

> I'm trying to understand the differences between $_GET and $_POST.
> Aside from writing to the url or not, is there any difference?
>
> Also, I want to have a page set up so that the url determines which
> navigation bar to use, but also have the page work in case that
> information isn't present.  Would I have to use $_GET to make it work?
>  Can somebody show me an example of how $_GET retrieves info from a url?

As you note, GET stores variable=value pairs in the URL.  POST sends the same kind of pairs in the
HTTP request body. 

Because of these locations, GET variables are more limited in the length of the data they can
contain.  For example, MS Explorer limits the length of a URL to about 2,083 characters.  Anything
else is cut off (or creates a security-nightmare buffer overflow -- just kidding a little). 

The POST length is also limited but is much much larger.  The actual size is indicated in the
php.ini file.

I'm not sure if you really want to know how PHP scans the URL to obtain each variable=value pair.
In your PHP program you can obtain these values with the $_GET superglobal:

$my_local_variable = $_GET['getvar'];

to obtain something from a URL formatted like this:

http://myserver.com/dir/script.php?getvar=123

Multiple variable=value pairs are separated with the ampersand (&) character.  Values should be
passed through urlencode() if you are writing your own from within a PHP program.

This should get you started.  95% of the time POST is best.  5% of the time GET is just what you
want.

James




Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list




SPONSORED LINKS
Php mysql Job postings


YAHOO! GROUPS LINKS




Reply via email to