HTML/JavaScript

Friday, August 23, 2013

$_GET, $_POST & $_REQUEST Variables

<?php
// $_GET
$productId = Mage::app()->getRequest()->getParam('product_id');
// The second parameter to getParam allows you to
// set a default value 
//which is returned if the GET value isn't set
$productId =Mage::app()->getRequest()->getParam('product_id',44);
$postData = Mage::app()->getRequest()->getPost();
// You can access individual variables like...
$productId = $postData['product_id']);
?>

No comments:

Post a Comment