$_GET variable display incomplete string

Hello Sitepoint friends,

Below is the PHP script that the $_GET[‘t’] will echo as “NOT SET” if the textarea string is too long, if it’s shorter then only it will display. This problem happened ONLY in my remote hosting server. BUT the text was printed out completely & without any problem in my localhost. Is there any php.ini cofiguration that deals with the $_GET variable ? Thanks. I know there’s one for $_POST like post_max_size in php.ini


<?php

if(isset($_GET['t']))
  echo $_GET['t'];
else
  echo "NOT SET";

?>

<form action="<?php echo $_SERVER["REQUEST_URI"] ?>" method="GET">
<textarea name="t" cols="20" rows="30">
We are different
With JobsCentral, you are not just advertising in one job portal but within an expanding network of 17+ affiliate career portals. What you get is a distinct database largely composed of graduates from local universities, polytechnics and tertiary institutions.


Effective and easy to use, JobsCentral is always developing cutting-edge technology to improve the online hiring process and augment our broad suite of recruitment and branding solutions. Our advertising towards jobseekers is aggressive and innovative; we employ print, online and mobile media to reach out to jobseekers and reward employers with the brand equity they deserve.


Providing more than just a job portal, we enhance user experience with our JobsCentral Community. Developed as an interactive site that attracts usage even when jobseekers are not looking for a job, it provides a platform for JobsCentral members to come together to share and exchange views. In addition, JobsCentral Community is also a rich source of comprehensive and relevant career-centric information. 


In short, no other job portal offers effective recruitment channels and robust content like JobsCentral.
</textarea>

<input type="submit" />
</form>

Or any ideas what is the cause of this effect ?

Thanks for reading until this end point :slight_smile:

If there is a setting for the maximum allowed length of the query string ($_GET), it’s in the actual web server like Apache or IIS, not in PHP.

The maximum recommended length however is 255 characters because some older proxy servers cannot handle more than that.

For lots of data consider using $_POST instead.

Thanks Boss, I follow your order, then it works :slight_smile:

w3c recommends that GET request should only be used for information retrieval, POST for sending info “as there name implies”

  • imagine if some one put a link like “http://www.yousite.com?t=alotOfcharacters…” in any website “Digg for example” then search engines will open it and so this data will be submitted whenever a search engineS parse this site with the such links!!!
  • You are also submitting a ‘textarea’! which is a big string , so there is a cross browser , servers compatibility issue because each one has a max length ,different specification than the other see :
    http://www.boutell.com/newfaq/misc/urllength.html

don’t forget the horrible CSRF “Cross-site request forgery”!
see:
http://en.wikipedia.org/wiki/Cross-site_request_forgery