Page 1 of 1

change variable when link is clicked

Posted: Sun May 02, 2010 1:41 pm
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.

Re: change variable when link is clicked

Posted: Sun May 02, 2010 2:33 pm
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.