Page 1 of 1

display page , when a link is clicked

Posted: Tue Mar 30, 2010 1:30 am
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

Re: display page , when a link is clicked

Posted: Tue Mar 30, 2010 2:26 am
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.