0

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

4
Contributors
6
Replies
8
Views
8 Years
Discussion Span
Last Post by Josh Connerty
0

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>
0

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

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.