Welcome Guest, Not a member yet? Register   Sign In
Problem with arrays
#1

[eluser]silent_assassin[/eluser]
I have stored $this->input->post values in an array which is contained in one function.When i try to print the array in another function it displays following error.Both the functions present in same controller.
Quote:Message: Undefined variable: products
This is my controller
Code:
<?php
class Product extends Controller
{

    function Product()
    {
        parent::Controller();
    }

    function index()
    {
        
        $this->load->view('collect_info');
    }
    public function preview()
    {
        if($this->input->post('preview'))
        {
            $this->load->view('preview_product');    
                
        $products=array(
                $this->input->post('p_name'),
                $this->input->post('p_model'),
                $this->input->post('p_short_desc')
        );
        }
        elseif($this->input->post('cancel'))
        {
            
        }
        
    }
    public function create()
    {
        print_r($products);
        
    }
}

?>
How this should be coded


Messages In This Thread
Problem with arrays - by El Forum - 07-23-2010, 12:18 AM
Problem with arrays - by El Forum - 07-23-2010, 01:13 AM
Problem with arrays - by El Forum - 07-23-2010, 01:26 AM
Problem with arrays - by El Forum - 07-23-2010, 01:33 AM
Problem with arrays - by El Forum - 07-23-2010, 01:36 AM
Problem with arrays - by El Forum - 07-23-2010, 02:01 AM
Problem with arrays - by El Forum - 07-23-2010, 02:06 AM
Problem with arrays - by El Forum - 07-23-2010, 02:23 AM
Problem with arrays - by El Forum - 07-23-2010, 02:32 AM
Problem with arrays - by El Forum - 07-23-2010, 02:45 AM
Problem with arrays - by El Forum - 07-23-2010, 03:01 AM
Problem with arrays - by El Forum - 07-23-2010, 03:03 AM
Problem with arrays - by El Forum - 07-23-2010, 03:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB