display page , when a link is clicked

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ajay600
Forum Newbie
Posts: 14
Joined: Tue Jan 19, 2010 8:54 am

display page , when a link is clicked

Post by ajay600 »

Consider i have given 3 web pages as input
$doc->loadHTMLFile('http://www.a.net/page_a.htm');
$doc3->loadHTMLFile('http://www.a.net/page_b.htm');
$doc2->loadHTMLFile('http://www.a.net/page_c.htm');

i have the code to remove the contents that are commonly repeated in all the 3 pages.. so now after removing same contents in page 1 , 2 and 3
finally when i want to display the output i did

echo $doc->saveHTML();
echo $doc2->saveHTML();
echo $doc3->saveHTML();

and it displayed all the 3 web pages one below the other

but i want to display the first page alone ( echo $doc->saveHTML() )
and when i click on a link that is present in page 1 , i have to display the second page(echo $doc2->saveHTML()) and when i click on another link available in page 1 i have to display the third page(echo $doc3->saveHTML())

how can it be done using php
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: display page , when a link is clicked

Post by omniuni »

Try adding a switch:

Code: Select all

<?php 

switch($variable){
case '1': echo 'I am page 1.';break;
default: echo 'I am default.';break;
}

?>
You can pass your $variable using ?var=foo and $_GET['foo'] will contain your variable.
Post Reply