Hi all,

I am working on webdirectory. But i want when i click on any link on that page then page should be same and informtion or contents of that page will be change. Let me explain---

Like i have one file index.php and here are so many linke like this
because i am fetching value from database: <a href="<?=$row['cat_name']; ?>-<?=$row['id']?>-1.html" title="<?=$row['cat_name']?>"><strong><? echo $row['cat_name']; ?></strong></a> Now suppose ="<?=$row; ?> have value Arts
<?=$row?> have value 100

Link is now index.php page
Arts/100-1.html now . I want this link should come index.php page
and now which information related to Arts Category and having id 100 should come on index.php page.

But i do not know i can fetch this different info with clicking on this type of link on index page or same page.

Please help me to solve this. I will be very thankful to him.
thanks,
gagan

Recommended Answers

All 6 Replies

this should work for you. You can build upon this.

It will call itself and allow the variables to be retrieved

<?php
if (isset ($_REQUEST['cat_name']))
{
   //do something here
}
?>
<a href="<?=$_SERVER['PHP_SELF'].'?cat_name='.$row['cat_name'].'&id='.$row['id'].'&title='.$row['title']?>"><strong><? echo $row['cat_name']; ?></strong></a>

my post came late i retract it

should have left it bro. always good to see multiple solutions :)

this should work for you. You can build upon this.

It will call itself and allow the variables to be retrieved

<?php
if (isset ($_REQUEST['cat_name']))
{
   //do something here
}
?>
<a href="<?=$_SERVER['PHP_SELF'].'?cat_name='.$row['cat_name'].'&id='.$row['id'].'&title='.$row['title']?>"><strong><? echo $row['cat_name']; ?></strong></a>

hi thanks for reply,

But i does not want to send in my url cat_name or id= as you have given in this example.

I want just that like the pls see the link

www.huntor.org

website . when i click on Arts . You will see how the value related to this Arts are coming on same page.

Like this i want to fetch this type of info on same page. I do not know how this have been done
Please help me to solve this.
thanks
gagan

It seems he has fixed it. Basicly what kireol said is probably the best way to pass varibles to another page.

The only shin dig I have is that the $_REQUEST method is not advised. Use the $_GET instead.

And again he is right when it comes to the mod rewrite. It doesn't turn your page address (http://example.ccom/index.php?id=something) into something pretty, it just provides another way of displaying it for example entering http://example.com/arts/100 will be re-written by apache so apache knows were to send it. The user will not see it, but what happens is apache changes it from what we had before to http://example.com/index.php?cat=Arts&id=100 for the server to parse it without the ugly URLS.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.