how to check for Notice (8) Undefined index
<p>I know why I am getting this error, and this is because there currenly no ratings for this specific dish, so it is null or empty but I am not sure how to handle it.. I tried this but still the same error came up..</p>

<pre><code>     if(empty($rate_dishes[$j]["DishRating"]["dish_id"]))
     {
        echo $this-&gt;Form-&gt;hidden('dish_id', array('value'=&gt; $this-&gt;params['var']));
     }
     else
     {
       echo $this-&gt;Form-&gt;hidden('dish_id', array('value'=&gt; $rate_dishes[$j]["DishRating"]["dish_id"]));
     }
</code></pre>

<p>Basically I am providing the dish id if its not provided by the posted array.. Whenever there is a rating for that particular dish it takes the 'else' condition.. but if it does not have a rating.. it gets to the first condition and still shows that error..</p>

<pre><code>the URL would be  /special_dishes/rate_dishes/4/?var=4
</code></pre>

<p>PS: new to CakePHP bare with me</p>
