Web Analytics Made Easy -
StatCounter is there a limit to url size? - CodingForum

Announcement

Collapse
No announcement yet.

is there a limit to url size?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • is there a limit to url size?

    I have a form, and the url has quite a few variables appended onto it. I am finding that it doesnt pass some variables that are towards the end of the url, or only bits of them. This made me think there is some sort of limit as to how much you can pass to a GET, anybody know if this is right and if so is there anything that can be done about it?
    Cheers, Andy.

  • #2
    That is indeed correct.

    Can't you use a POST-method instead of the GET-method?
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

    Comment


    • #3
      hmmm, i could, although i reckon I can still use get but reduce the no. of variables and just get them back with another query in the next page.

      Comment


      • #4
        Euh ... It's not the number of variables but the number of characters that determines the cutoff.

        If you don't realy need to pass the variable-value pairs in the quertystring, then there is simply no reason to use the GET-method. POST is far more userfriendly + doesn't have the cutoff.
        Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

        Comment


        • #5
          The page im working on isnt a form with inputs though - it just displays data so doesnt that mean I would have to put every variable into a hidden field to be able to access it with a post?

          Comment


          • #6
            well, i don't know your concrete situation, but you could just as well store the values in sessionvariables or an session variab that is an array. So that they don't need to be dragged along over the client, and there is no risk of manipulation of the values, by the client. You could also store the complete querystring inside a variable and then explode it (see below) (or you couls store themin a textfile or db)

            Or you could indeed store them all in hidden formfields or store the complete querystring as the value of one hidden formfield. You could then make then usable like
            PHP Code:
            $varvalues explode('&'$thevariable);
            foreach (
            $varvalues as $varvalpair){
                    
            $pair explode ('=',$varvalpair);
                    $
            $pair[0] = $pair[1];

            After that, you can use them as like regular values.
            For instance, if your initial $thevariable looked like 'product=test&item=5&quant=10
            then the code above will transform it into 3 variables
            $product (which value will be 'test')
            $item (which value will be 5)
            $quant (which value will be 10)

            But dragging them along in the querystring should only be done i you can't avoid it ...
            Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

            Comment


            • #7
              right I see, thanks for that!

              Comment

              Working...
              X