Jump to content

[SOLVED] Target the table using <?include ......?> problem!


ztealmax

Recommended Posts

hi im using include to target a specific table as shown below:
my [b]index.php[/b]
[code]<? include("menus/mainmenu.php");?>
<? echo $HEADER ?>

<table><tr><td>
<?php
if(isset($_GET['content'])){
include($_GET['content'].".php");
} else {
echo "&nbsp;";
}
?>[/code]
</td></tr></table>

this is my read code:
[code]<?php
$file = $_GET['text'];
$fh = fopen($file, 'r');
$data = fread($fh, filesize($file));
fclose($fh);
?>
<? echo $file;?>
<pre>
<? echo $data;?></DIV></pre>
<? echo lan_10 . date ("F d Y H:i:s.", filemtime($file)); ?>[/code]

I use [b]read.php?text=news/titleoffile.txt[/b] to open for reading

What i am having problem is how to make a workable link so it includes it in table on index.php file you saw ontop of my post
useally i would use for a single php file this:
[code]<a href="<?=$_SERVER['PHP_SELF']?>?target=members">Members</a>[/code] that would open the file
[i]members.php[/i] in this area of [i]index.php[/i] [code]<?php
if(isset($_GET['content'])){
include($_GET['content'].".php");
} else {
echo "&nbsp;";
}
?>[/code] SO my question is how can i make it open if i have a file like mine that opens one more file for reading? as shown here: [code]<a href="read.php?text=news/<?php print($value["name"]);?>" target="content"><?php print($value["name"]);?></a>[/code]
/Thanx for all help
Martin
Link to comment
https://forums.phpfreaks.com/topic/32013-solved-target-the-table-using-problem/
Share on other sites

From what I see you have a couple things wrong.

first you are looking for $_GET['content'], there is not variable called content in your link

[code]<?php
if(isset($_GET['content'])){
include($_GET['content'].".php");
} else {
echo "&nbsp;";
}
?>[/code]

So your link would be something like so
[code]<a href="<?=$_SERVER['PHP_SELF']?>?content=read&text=news/<?php print($value["name"]);?>"><?php print($value["name"]);?></a>[/code]

Ray


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.