Jump to content

How to read page, send url back, and read in new page? (staying on same page)


whitedragond

Recommended Posts

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

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'>

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.

 

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.