today we are Learn How to transfer data from Controller to View Magento.
Magento have a inbuilt function to pass array from controller to Phtml file. You can Pass any Data Like a Array String using this Method.
First You have to Store a Value in one variable.
$cars = array("Volvo", "BMW", "Toyota");
Its You array You want to pass a result in phtml file from controller Magento. then You can use Mage::register method to pass array in controller.
Now Set this value in Your Controller.
In this line the cars_data name is only name to access the data in phtml file. You can writer here any name as per Your Choice.
Now Get Data in Your View Phtml File.
$car_value = Mage::registry('cars_data');
Now You Can Store the data in a Variable and you can Check the getting data using var_dump($car_value );