Refreshing a page adding GET vars.
So I am creating an application that requires 3 variables to be passed to some page.php.
I need $_GET['x'], $_GET['y'], and $_GET['z'] to be passed to the page.
I have an if statement that I have created now to catch if any of these 3 vars have not been passed, however I am wondering if it's possible to reload the current page in PHP, appending default values for these variables to the URL.
For example, if someone requests page.php it will automatically change it to page.php?x=1&y=2&z=3.
if(!isset($_GET['x']) || !isset($_GET['y'] || !isset($_GET['z']))
//load currentURL + "?x=1&y=2&z=3";
Thanks in advance! .
Do you really need to reload a page with a default query string? Why not:
if (!isset ($_GET['x'])) $_GET['x'] = '1';
// ...move on knowing that $_GET['x'] has something useful in it.
The reason I was wanting to reload the page with default GET values set is because the page will have two different stylesheets / layouts being used depending on what stage of the application the user is in.
If the user goes to the page for the first time, they will select a series of default settings, and then next time the application is run by that user, all of those settings will be remembered.
However, just for default testing purposes now I dont want to have to go to through the lengthy process of creating a "profile" everytime I want to test the second section of the application.
Ah, got it. From PHP you could do:
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)