Forum Moderators: mack

Message Too Old, No Replies

Php Help!

including files

         

silk

9:12 am on Aug 11, 2004 (gmt 0)

10+ Year Member



Hi, i'm VERY NEW to php. I know php can be used to include files into an html page. Trouble is, i want to include different files into a SPECIFIC <div></div> area depending on the link clicked. It keeps opening a new page, which is NOT what i want. How do i get the php files to be included in the determined <div> area?

Thx...:¦

silk

4:10 am on Aug 12, 2004 (gmt 0)

10+ Year Member



nevermind, I GOT IT! HA!

mack

1:21 am on Aug 17, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Care to share ;-)

Mack.

silk

4:08 am on Aug 18, 2004 (gmt 0)

10+ Year Member



Sorry, sorry.

Okay. i used query strings and a switch statement. the query string goes the hyper link like : <href="path/file.php?page=somevalue">

Then i put the switch in the div where i want the file included.

CODE FRAGMENT :

<div class="centerStrip" align="center">
<?php
switch($_GET['page']){
case 'somevalue':
include("somefile.inc");
break;
case 'othervalue':
include("anotherfile.inc");
break;
case 'yetanothervalue':
include("someotherfile.inc");
break;
default:
include('welcome.inc');
break;
}
?>
</div>

i used .inc extension for the included files.

You can use the switch in any <div>Area</div> where you want text to change depending on the link clicked. I included small text files with a little intro to the topic clicked on.

- silk -