www.webdeveloper.com
Results 1 to 9 of 9

Thread: [RESOLVED] Session variables and $_POST

  1. #1
    Join Date
    Sep 2004
    Location
    At the corner of WALK and DONT WALK
    Posts
    1,741

    resolved [RESOLVED] Session variables and $_POST

    Is the number of session variables you can have tied to the number of variables you can send through $_POST?

  2. #2
    Join Date
    Nov 2008
    Posts
    2,477
    No.

  3. #3
    Join Date
    Sep 2004
    Location
    At the corner of WALK and DONT WALK
    Posts
    1,741
    Thank you. I've run into a serious problem with $_POST (there's a limit to how much data I can send), so I have to find alternate means.

  4. #4
    Join Date
    Nov 2008
    Posts
    2,477
    The HTTP/1.1 spec doesn't define a limit on POST size IIRC. It's down to the server and browser, but it should be fairly large. You may find the limit is coming from php.ini's max_post_size setting which you can change within your script. How much data are you trying to send? What are you ultimately trying to achieve? Where are your limits coming from?

  5. #5
    Join Date
    Sep 2004
    Location
    At the corner of WALK and DONT WALK
    Posts
    1,741
    A form with around 600-odd fields. However, I did some digging and discovered that the server's security software limits me to 200 POST variables. After some discussion, I'm trying a different tack, and using JavaScript to do it server-side.

    EDIT: CLIENT-side. Whoops.

  6. #6
    Join Date
    Nov 2008
    Posts
    2,477
    Never heard of a server limiting the number of post fields before, very odd. I assumed you meant a data size limit. If you decide you need PHP after all you could always do something like json encode the data into fewer fields via js before submitting, then json_decode it on the server. Not ideal since it requires JS though. Maybe another option would be to use array fields, but I don't know whether the server would still see them as separate - I expect it probably would.

  7. #7
    Join Date
    Sep 2004
    Location
    At the corner of WALK and DONT WALK
    Posts
    1,741
    Quote Originally Posted by Mindzai View Post
    Never heard of a server limiting the number of post fields before, very odd. I assumed you meant a data size limit.
    Here's the phpinfo() page: http://fba.furtopia.org/php_info.php

    Here's the string to find: "suhosin.post.max_vars"

    Quote Originally Posted by Mindzai View Post
    If you decide you need PHP after all you could always do something like json encode the data into fewer fields via js before submitting, then json_decode it on the server. Not ideal since it requires JS though.
    Actually, what I ultimately did was even more JS-heavy: The form was used to create XML code, so I created a script to parse the form and write the code.


    Quote Originally Posted by Mindzai View Post
    Maybe another option would be to use array fields, but I don't know whether the server would still see them as separate - I expect it probably would.
    I tried. It does.

  8. #8
    Join Date
    Nov 2008
    Posts
    2,477
    Ah didn't realise suhosin limited post vars, I've never run into that issue before. If you have control over the php.ini file you can always change the 200 limit for that directive. Glad you got it sorted anyway.

  9. #9
    Join Date
    Sep 2004
    Location
    At the corner of WALK and DONT WALK
    Posts
    1,741
    I didn't realize that issue existed. I had no idea what was going on until I ran the following code:

    PHP Code:
    $game_info = '';
    $count = 1;
    foreach(array_keys($_POST) as $k1){
           $game_info .= 'Slot ' . $count++ . ': ' . $k1 . n;
    }

    ...

    <form action=""><div><textarea cols="150" rows="30"><?php
    echo $game_info ?></textarea></div></form>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles