This is more of a PHP question, I think. I added a custom page to my site that can be accessed like this:
The thing is that this page is self-submitting, and I would like to add the form variables to the query string. Currently, when the form submits, the URL looks like this:
But I would like it to do something like this:
In other words, it’s going back to index.php (my default shopping cart page) instead of index.php?target=custompage (my custom page). I’m relatively new to PHP. Can someone tell me how to get the desired behavior? Thanks.
I’m wondering if what I’m asking for is even possible. It’s weird because when I type in the whole query string directly into the address bar like this:
the page behaves correctly. However, if I try to get this behavior by submitting the form on my custom page to itself, the page reloads to index.php instead of index.php?target=custompage.
Is it possible to reload to a URL that has a query string appended to it, such as [url]http://www.mysite.com/index.php?target=custompage[/url], and then add new variables to the query string when the page submits to itself? Any input would be greatly appreciated. I’ve been pulling my hair out trying to figure out how to put this page into my site…
Just in case anybody else is trying to do this, I’ll tell you what I did. I’m not sure if this is an elegant solution, but it works. Put this code in your form:
This line will explicitly assign the name of your custom page to the “target” variable each time the form is submitted. However, since it’s hidden, the form element will not show up on the page.