Jump to content

Recommended Posts

Good day everyone!

 

I know this is possible but I do not know how to do it.

 

I have a single page, this page has no dynamic content.

 

I have a set of links. What I need is to have content placed on the page based on the link the user clicks.

 

Example: I have pictures of animals. When the user click a Zebra, the Zebra info is placed on the page.

 

So the page does not change, meaning the content on the page changes but not the page it self.

 

The idea is instead of creating different html pages for each animal profile, the profile is generated to the page from a php include file.

 

Is is this possible?

 

Can anyone, some one please point me to how I can get this going.

 

 

Thanks everyone!

 

 

IC

I think what you are trying to do is change the links in a way that when you click on the link it shows on the same page?

 

Try:

 

echo "
<table>
<tr>
<td>";
echo "<a href='index.php?p=somewhere"> Somewhere </a>";

echo"
</td>
</tr>
";
$somewherevariable = $_GET['p'];
if(isset($somewherevariable))
{
$path = "foldername/" . $somewherevariable . ".php";
}
include ($path);
echo"
<tr>
<td>
";

echo"
</td>
</tr>";

 

Hope this helps you. Just reply if you need help.

I think what you are trying to do is change the links in a way that when you click on the link it shows on the same page?

 

Try:

 

echo "
<table>
<tr>
<td>";
echo "<a href='index.php?p=somewhere"> Somewhere </a>";

echo"
</td>
</tr>
";
$somewherevariable = $_GET['p'];
if(isset($somewherevariable))
{
$path = "foldername/" . $somewherevariable . ".php";
}
include ($path);
echo"
<tr>
<td>
";

echo"
</td>
</tr>";

 

Hope this helps you. Just reply if you need help.

 

Thank you very much for your time and effort!

I know a bit of PHP so I can understand the codes a little.

 

I seem to be understanding most except the somewhere variable.

Will the somewhere variable contained the content that is written when the link is click?

 

example:

<?php $somewherevariable = "animal profile"; ?>

 

Thanks again!

 

IC

 

This looks like what I need, thanks for the link I am looking at the possibilities as to how I can use this.

 

Thanks again!

 

IC

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.