whitedragond Posted April 9, 2008 Share Posted April 9, 2008 Ok, here is what I'm trying to do. For testing I have an index page that shows links, either 1 or 2. If you click on 1, it goes to 1.php and you have the option of choosing A or B. Clicking on A brings up the A.php page and it has options to go to 1 or 2. It just keeps repeating pending what url link you choose. Basically, I'm looking for a way to read in a URL and parse the information. After seeing that I have the option of choosing 1 or 2, it will pick one (I'll define it what to choose) then continue on. I'm not sure what the best way to go about this is and to keep it on my testingscript page and not actually be redirected to the linking page. I was trying to think of something like a loop, so I can make it run twenty times. It would read the url, see what info is on it, then send back a request to go to a specified url and then read what one it went to, then choose another link off the new page. It would have to stay on my testlinks.php script page. thanks for any help you can provide Link to comment https://forums.phpfreaks.com/topic/100374-how-to-read-page-send-url-back-and-read-in-new-page-staying-on-same-page/ Share on other sites More sharing options...
jack5100nv Posted April 9, 2008 Share Posted April 9, 2008 Index.php if($page=="2) { include 2.php here } else { include 1.php here } 1.php link to page 2: <a href='index.php?page=2'> if($subpage=="A") { include a.php here } elseif($subpage=="B" { include b.php here } else { include somwehting else here } 2.php link to page 1: <a href='index.php'> link to subpage A under page 1: <a href='index.php?page=1&subpage=A'> or <a href='index.php?subpage=A'> Link to comment https://forums.phpfreaks.com/topic/100374-how-to-read-page-send-url-back-and-read-in-new-page-staying-on-same-page/#findComment-513321 Share on other sites More sharing options...
writer Posted April 9, 2008 Share Posted April 9, 2008 Check out predefined variables. $var = $_SERVER['DOCUMENT_ROOT'] should capture the page URL. Link to comment https://forums.phpfreaks.com/topic/100374-how-to-read-page-send-url-back-and-read-in-new-page-staying-on-same-page/#findComment-513322 Share on other sites More sharing options...
whitedragond Posted April 9, 2008 Author Share Posted April 9, 2008 gives me an idea will have to try later. function getpageinfo($data) { //blah blah find this value based upon something, return it to a file. } //insert loop here. $page = Include (http://whatever/1.php) // can I assign this to a file so i can parse it into a function? $parseinfo = getpageinfo($page) //cycle through the loop again with the new link of where to go or what to include on the next one. Link to comment https://forums.phpfreaks.com/topic/100374-how-to-read-page-send-url-back-and-read-in-new-page-staying-on-same-page/#findComment-513336 Share on other sites More sharing options...
whitedragond Posted April 9, 2008 Author Share Posted April 9, 2008 The question is... does an included actually execute a link function? If you manually go to 1.php, then it does some execution on the backend, updates a database, then displays the page pending what was chosen. Thinking included just copies the html code and displays it, not actually executing the link. Also thought about a popup, but then I have an issue of being able to return the new link back to the main window when the code is on another server. Link to comment https://forums.phpfreaks.com/topic/100374-how-to-read-page-send-url-back-and-read-in-new-page-staying-on-same-page/#findComment-513341 Share on other sites More sharing options...
jack5100nv Posted April 9, 2008 Share Posted April 9, 2008 included will execute any executable php code in that file. it does not just copies the html. Link to comment https://forums.phpfreaks.com/topic/100374-how-to-read-page-send-url-back-and-read-in-new-page-staying-on-same-page/#findComment-513349 Share on other sites More sharing options...
whitedragond Posted April 10, 2008 Author Share Posted April 10, 2008 Ya, that's where the problem lies.. this test script will be pointing to a different server, so I need that remote server to execute the link from their side, just not include what's displayed in html... Link to comment https://forums.phpfreaks.com/topic/100374-how-to-read-page-send-url-back-and-read-in-new-page-staying-on-same-page/#findComment-513909 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.