Forum Moderators: coopster

Message Too Old, No Replies

PHP $ POST / Forms query

         

scottcabal

11:48 pm on Jun 21, 2012 (gmt 0)

10+ Year Member



I'm sure I'm overlooking something very simple here.

On the new version of my site I'm trying to avoid addresses like index.php?page=this&action=that so I'm using my own template system. I'm trying to make it nice and tidy too so instead of having for example /pages/this.php I can have /pages/this and then either have an index.php file in the "this" folder or use a custom 404 error file to grab the appropriate page I haven't decided yet.

The issue I have is with forms. When I submit the form to to, in the above example lets say, to /pages/this/index.php the form works and any post variables are displayed or processed as required, but when I submit to /pages/this the index.php file loads but the script is unable to read any post variables and I'm not sure why.

Is there any way to make sure my index.php file is able to pick up the post variables when using the above method? I've seen plenty of sites that have forms submitting to /login for example so know there has to be a way to do it.

Thanks in advance :)

scottcabal

12:37 am on Jun 22, 2012 (gmt 0)

10+ Year Member



Ok I've managed to answer this one myself - it was to do with my htaccess rules. I'm using some rules to create virtual subdomains for clients and it's that which is causing the post vars to be dropped. going to virtualsubdomain.domain.com/form.html and submitting the form does not work but going to domain.com/form.html and submitting the form does.

Now I just need to work out how to get those htaccess rules to allow my post vars lol

rocknbil

4:16 pm on Jun 22, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you using R=301 (or any redirect)? That will do it.

scottcabal

5:22 pm on Jun 22, 2012 (gmt 0)

10+ Year Member



Nope I wasn't using redirect but I managed to work out that the way I was creating my virtual subdomaing (using rewrite) somehow was deleting my post variables. I noticed if I used the form at my main domain it worked, but in the virtual subdomains it didnt. I was recommended to use a wildcard vhost in my site control panel to handle virtual subdomains as opposed to using apache rewrite and now it works on all subdomains :).

Thanks though :)

g1smd

6:57 pm on Jun 22, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Use the
[QSA]
flag to re-appeand the original parameters when rewriting requests.