Search code examples
javascriptphphyperlinkgetlimit

How many parameters get can I use on a link?


I'm having some trouble receiving information through $_GET[' ']. I send a request to a PHP document, like this

procura_plano.php?plano='+plano+'&operadora='+operadora+'&contrato='+contrato+'&idade='+idade+'&acomo='+acomodacao+'&valor='+valor

because I'm using javascript to make the request. But the last value seems not to be set. Is there a limit of parameters that I can pass through the link?

Sorry for my english :/


Solution

  • Please note that PHP setups with the suhosin patch installed will have a default limit of 512 characters for get parameters. Although bad practice, most browsers (including IE) supports URLs up to around 2000 characters, while Apache has a default of 8000.

    To add support for long parameters with suhosin, add suhosin.get.max_value_length = <limit> in php.ini

    For More info check this link or URL parameters- Stack Overflow

    What w3 Schools say is: Yes, when sending data, the GET method adds the data to the URL; and the length of a URL is limited (maximum URL length is 2048 characters)

    Check this, GET URL Parameters- w3 Schools