Take the 2-minute tour ×

how can I send PHP parametres, get method like .php?id=xx I am using K2 items with Joomla. Currently I am printing out all results fetched from database using PHP. When user clicks on one of the results it should send him to different page and that page should get id of the thing user clicked. How do I do it if joomla shows me sites like: joomla.com/index.php/example-showing-this/

share|improve this question
add comment

2 Answers

This is a very broad question, and we'd more details to better help you. On a broad level, you can generate these URLs using PHP and JRoute http://docs.joomla.org/JRoute/1.5

You may also find this thread helpful too https://groups.google.com/forum/?fromgroups#!topic/joomla-dev-general/1548yu9I2jQ

share|improve this answer
add comment

When the user is able to click on things this is no longer PHP, this is HTML and javascript. PHP is executed on the server, the result of this execution is the HTML+CSS+Javascript that the user downloads to its pc.

From what you descrived you need to generate the correct HTML+javascript using the PHP variables you get from the database, for example:

echo "<a href=\"your_php_page.php\">Click me</a>";

This will display a link, but it will not pass any parameters, if you want to pass a id using GET you should do it like this:

echo "<a href=\"your_php_page.php?id=$id\">Click me</a>";

In the your_php_page.php you can receive this id like this:

//if you are going to use this in a query you should do something like this to prevent injection

If you want to use POST, you will have to submit a form or use AJAX, but that's more advanced, you should focus on making it work using GET.

share|improve this answer
this is Joomla, you dont use URL's like your_php_page.php –  Lodder Jun 11 '13 at 14:45
With Joomla having it's own framework, it provides better methods from accessing $_GET variables, see docs.joomla.org/Secure_coding_guidelines –  betweenbrain Jun 12 '13 at 0:21
add comment

Your Answer


