Hey.. First of all, I haven't used include_once() command before.. I have a home page (page1.php) from where I am going to page2.php. (with the help of include_once()). I have some echo commands in page2.php. But now when I am visiting my page1.php, I am getting the echo commands in page2.php displayed in page1.php even before clicking the link. I understood that, its because my page2.php is included once when I visit page1.php.. But I don't want this to be displayed in page1.php and I couldn't figure out how I can do that. Can anyone please help me in knowing what I can do to avoid this? Thanks for your help..
You could modify your echo's by adding: <?php if($_SERVER['PHP_SELF'] == "/page2.php"){ echo "Text you want to display when on page2.php } ?> PHP: This will only echo if its on page2.php.
Hey.. But I wonder if I pass parameters through the URL from page1.php to page2.php , then will this 'if' statement still work..? if($_SERVER['PHP_SELF'] == "/page2.php") Because it worked for me in the beginning. But now when I pass parameters from page1.php to page2.php (through URL), I am not getting any of my 'echo' statements displayed. Not in page1.php or page2.php.. Any thoughts on this please? (I even tried to change the 'if' statement to include my parameters to see if that helps! ..newbieee!! ) Thanks..