How to assign a value to an associative array
<p>I have an associative array called <code>$data</code> and a function called <code>sendToView()</code> which is accepting <code>$email</code> and <code>$vehicleid</code> as parameters. I need to assign those parameters to <code>$data</code> array. How can I do that?</p>

<p>Here I have mentioned what I have tried but it is giving <em>"Trying to get property of non-object"</em> error. How can i solve that?</p>

<pre><code>public function sendToView($email, $vehicleid) {        
    $data['details'] = array(
        'email' =&gt; $email,
        'id'    =&gt; $vehicleid
    );

 $this-&gt;load-&gt;view('pages/OfferView',$data);
}
</code></pre>

<p>offerView.php</p>

<pre><code>&lt;?php foreach ($details as $detail) {?&gt;



                        &lt;form name="myform4" action="&lt;?php echo base_url(). 'OfferCtrl/sendEmailToReview/'. $detail-&gt;email .'/'. $detail-&gt;id ;?&gt; " method="POST"&gt;
</code></pre>

<p>I have done this in offerView.php.Is that error occurs due to this? </p>