_Unique_ Posted May 5, 2015 Share Posted May 5, 2015 (edited) Hello, I know this question has been previously asked either on this forums or elsewhere, but all of the questions I could find were asking for the path, whereas I am asking for the value. Okay, now for the question and explanation. How can I get the value from a url, for example; If the url is http://mywebsite.com/install/install.php?step=2 How could I get the value 2 so I can only show the content for that step and not for any other step. Thanks in advance, Unique EDIT: Okay, I just solved my own question with $_GET['step']. But I have another question, how could I automatically assign a step to the user once they are on the page, so the will automatically start on Step 0 (the introduction) then move onto step 1 once the have pressed a link or a button, then move onto step 2, etc, etc. Edited May 5, 2015 by _Unique_ Quote Link to comment Share on other sites More sharing options...
ginerjm Posted May 5, 2015 Share Posted May 5, 2015 You don't provide nearly enough info to help us to help you. How did they get to the page they are on? If they are on a specific page, how do you know they don't want to stay on that page and not go to your idea of the page they should be on? If they got to this page, why should they be re-directed? How did they get to this page anyway? If you had a specific entry page/point for your 'steps', then the way to progress thru the series would be to have 'Next' and 'Prev' buttons that have the proper urls in them. Theses would be setup by your script that generates each page. (if generating page 4 then you would create the Next button with a "?step=5" and the Prev button with a "?step=3" in the src of any link tag or the action of any form tag.) Quote Link to comment Share on other sites More sharing options...
_Unique_ Posted May 5, 2015 Author Share Posted May 5, 2015 The page I am creating is an install script, it automatically connects the database, creates the admins, uploads the database, etc. There are going to be steps, that the user has to follow, starting from step 0, which I am hoping to force the user to start on that step. As it is an install script, I have made it so any page that the user attempts to load, they will be automatically redirected to the install page, until the website is setup. I have already created this script, and it is fully functional. I just need help with creating each step, so when the user first starts the install, they will start on step 0, then when they have finished step 0, they can press the next button, which will take them to step 1, etc. I just need help forcing the user to start on step 0, and then automatically changing the Step value in the url. I already know how to pull the value from the url. Sorry about not giving enough information, hopefully this makes it more clearer. Quote Link to comment Share on other sites More sharing options...
Psycho Posted May 5, 2015 Share Posted May 5, 2015 (edited) Personally, I would use session values instead of values on the query string, but since that is what you are using: $step = isset($_GET['step'])) ? intval($_GET['step']) : 0; Edited May 5, 2015 by Psycho Quote Link to comment Share on other sites More sharing options...
_Unique_ Posted May 5, 2015 Author Share Posted May 5, 2015 Personally, I would use session values instead of values on the query string, but since that is what you are using: $step = isset($_GET['step'])) ? intval($_GET['step']) : 0; Okay, thanks, how would I go about doing it with session values? Quote Link to comment Share on other sites More sharing options...
Psycho Posted May 5, 2015 Share Posted May 5, 2015 Okay, thanks, how would I go about doing it with session values? $step = isset($_SESSION['step'])) ? intval($_SESSION['step']) : 0; But, I'm not going to give you a tutorial of how to set and manage session variables. Go do some research first. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.