Magento 1.9: How to Add Post Data to URL

magento-1.9PHP

I have my basic product listing, which redirects to the product view page like this: <a href="<?php echo $_product->getProductUrl() ?>"> Now I want to add my own variable to the url but I have no idea how to achieve that.

I've tried just simply adding ?value=value but it returns errors

Best Answer

You cant add a POST parameter to an URL. What you can do is add a GET parameter to the url like this:

<a href="<?php echo $_product->getProductUrl() ?>/name_of_param/value">Link</a>

and retrieve it afterwards with

$this->getRequest()->getParam('name_of_param');
Related Topic