Results 1 to 5 of 5

Thread: POST array empty, but GET array has data

  1. #1
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default POST array empty, but GET array has data

    Hi guys,

    Having a strange issue here...

    If I submit a form and set the method as post, the post array is completely blank, however if I change the method to get, the array is full of data.

    This script used to work, so I don't know what I've done to mess it up, anything obvious you can think of?

    I have some htaccess rules that could possibly affect it (not sure)?

    Here's the htaccess code anyway:

    Code:
    DirectoryIndex home.php
    
    Options +FollowSymLinks
    Options -Indexes
    
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(.*)/$
    
    RewriteRule ^(.*)$ http://antidote.dev/$1/ [L,R=301] 
    
    RewriteRule ^friends/$ friends.php [L]
    #RewriteRule ^shop/(.*)/(.*)/$ shop.php?category=$1&prod=$2 [L]
    RewriteRule ^friends/(.*)/$ friends.php?id=$1 [L]
    RewriteRule ^friends/(.*)$ friends.php?id=$1 [L]
    RewriteRule ^tags/(.*)$ tags.php?tag=$1 [L]
    #RewriteRule ^shop/(.*)/$ shop.php?category=$1 [L]
    
    RewriteRule ^shop/category/(.*)/?$ shop.php?category=$1
    #RewriteRule ^shop/(.*)/(.*)$ shop.php?category=$1&prod=$2 [L]
    
    RewriteRule ^shop/(.*)/?$ shop.php?prod=$1 [L]
    
    RewriteRule ^links/$ links.php
    RewriteRule ^ethics/$ ethics.php
    RewriteRule ^tags/$ tags.php
    RewriteRule ^friends/$ friends.php
    RewriteRule ^blog/$ blog.php
    RewriteRule ^downloads/$ downloads.php
    RewriteRule ^stockists/$ stockists.php
    RewriteRule ^contact/$ contact.php
    RewriteRule ^home/$ home.php
    RewriteRule ^about_us/$ about_us.php
    RewriteRule ^shop$ shop.php
    RewriteRule ^basket/$ basket.php [QSA]
    RewriteRule ^thanks/$ thanks.php
    RewriteRule ^terms/$ terms.php
    RewriteRule ^error/$ error.php
    
    ErrorDocument 404 /error
    
    # BEGIN Gzip
    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
    </IfModule>
    # END Gzip
    The code for the form is just simply:

    Code:
    <form action="/basket" method="post">
    <!-- A few form elements -->
    </form>
    Hope you can help me out.
    Last edited by Schmoopy; 06-14-2011 at 04:55 PM.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    I don't have time at the moment to fully debug this, but I had a similar situation a few months ago. It turned out that it was due to the trailing slash on directories. Essentially if the trailing slash was missing, it added it, but in doing so actually did a redirect and dropped the post data (but the get data might still be there). I don't know if this is the problem, but you can test to see if .htaccess is related by using the same script on another page. Pay close attention to the URL (with or without .htaccess) to see if there's anything that might be a problem with that. I hope that helps a bit.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    Hi djr33, yea I forgot to post a reply to this thread, but it's exactly what you said.

    Shortly after I made this thread I tried sending requests to /basket/ instead of /basket, and miraculously, it started working

    Thanks for the help anyway!

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 517 Times in 503 Posts
    Blog Entries
    5

    Default

    have you considered rewriting your htaccess rules to make the trailing slash optional?

  5. #5
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    I used to have it like that, but I prefer the URLs with trailing slashes, looks neater imo.

Bookmarks

Posting Permissions

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