php - How to solve undefined index in view? -
my array ($response_array) :
array ( [auth] => array ( [userid] => test [userip] => 123 [xmlversion] => testing version ) [searchavailrequest] => array ( [countrycd] => id [citycd] => jog [checkin] => 2016-01-08 [checkout] => 2016-01-09 ) [searchavailresponse] => array ( [hotel] => array ( [0] => array ( [hotelno] => 1 [hotelcode] => 321 [hotelname] => test 1 hotel [rmgrade] => deluxe [rmgradecode] => dlx ) [1] => array ( [hotelno] => 2 [hotelcode] => 212 [hotelname] => test 2 & 1 hotel [rmgrade] => deluxe [rmgradecode] => dlx ) ) ) )
i want send hotel data view
so view display data :
hotel name room type
i try :
controller :
... return view('frontend.hotel.main_list_hotel',[ 'hotel' => $response_array['searchavailresponse']['hotel'] ]); ...
view :
@foreach($hotel $key=>$value) {{ $key }} {{ $value['hotelno'] }} @endforeach
but, there exist error :
errorexception in testcontroller.php line 181: undefined index: searchavailresponse
in localhost there not error. there error in server
any suggestions on how can solve problem?
thank much
Comments
Post a Comment