We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32070
    • 87 Posts
    I've been working on a new Revo 2.1.3-pl installation with two contexts. In addtion to the default web context I've added a context called 'kiosk' following all of the steps on rtfm.modx.com. Everything seemed to be working perfectly, until.....

    I tried to set up a form to receive some basic user data, using method="post" back to the same resource that the form was on. It looked like this:

    <form method="post" action="[[~[[*id]]]]">


    No matter what I did, I couldn't get the $_POST array to actually register anything. Every time it was just an empty array. I made sure that all of my elements were uncached, etc. method="get" worked just fine.

    Out of curiosity, I tried everything back in my 'web' context and of course, it started working like it was supposed to. All of my $_POST variables showed up exactly like they have a hundred times before.

    So, I tried one more time back in my 'kiosk' context but this time I left off the action attribute so I just had:

    <form method="post">


    It worked normally? !?!

    Is there any obvious reason why my $_POST variables aren't working in my 'kiosk' context? Is there a bug or something? Something I'm missing?

    I'm running PHP 5.3.8, Apache 2.2, MySQL 5.1.52-log.

    Any help GREATLY appreciated. [ed. note: webandflow last edited this post 15 years, 1 month ago.]
      Des
      webandflowdesign.com
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      I know some people have had issues with POSTs getting lost on IIS using friendly urls, but that doesn't seem to be the case.

      When you add the action, does it resolve to the right link? Is there actually something being posted (check with firebug)? Any redirects taking place (again check with firebug)? Any difference when using $_REQUEST instead of $_POST? Anything in the error log?

      I personally prefer using FormIt with a hook (info on that: http://rtfm.modx.com/display/ADDON/FormIt.Hooks) but it should just work normally aswell.

      It may help to post how you set up the second context as well in terms of settings and files / modifications you used.
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 32070
        • 87 Posts
        So...

        I'm an idiot. Here's why....

        <base href="[[++site_url]]" /> 
        <!-- set for my context to www.domainname.com -->
        
        <!-- in .htaccess --->
        RewriteCond %{HTTP_HOST} .
        RewriteCond %{HTTP_HOST} !^domainname\.com [NC]
        RewriteRule (.*) http:\/\/domainname.com/$1 [R=301,L]


        So, my htaccess was redirecting to the non-www.... while my form was trying to submit to the www version. Post was getting lost.

        Thanks for the suggestion to check the redirects smiley

        (I added the \ to the htaccess, just so the forum wouldn't make a link out of it)
          Des
          webandflowdesign.com
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          Glad you got it solved!
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.