change variable when link is clicked

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
c_pattle
Forum Newbie
Posts: 9
Joined: Sat Apr 24, 2010 7:35 am

change variable when link is clicked

Post by c_pattle »

Hey

I'm have page that when it loads display all the records from a mysql database that contain the value "kitchen" in the field "department". I have a link called home and when its is clicked I want this to change so it display all records from the database with the value "garden" in the field "department". Is there a way to make a variable change when a link is clicked (<a> tag)?

Thanks for any help.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: change variable when link is clicked

Post by requinix »

A link just loads a PHP page. If you can make a script do what you want then all you have to do is point the link to it.

Recommendation: since this is like a search form, put the value you want in the URL (like page.php?department=garden) and use $_GET to access it. Then search on that term.
Post Reply