Pulldown: adding specific values coming from entities




I'm new in Elgg and I'm trying to find a way to have the right "pulldown". I explain:


I'm doing a form where people can book things.


The subtype in database is called "ressource". So, the first thing I do is to get all the entities with this subtype in the file book.php:


$ressources = elgg_get_entities(array('type'=>'object','subtype'=>'ressource'));

I need the titles as value to put between <option></option> and I'm also doing an array with all the guids.

foreach ($ressources as $r){


$titles[] = $r->title;


Then I'm sending these to form_book.php:

$area2 .= elgg_view("grr/form_book",array('titles'=>$titles,'guids'=>$guids));


In book.php, I've this code for now:

    <p><?php echo elgg_echo("Ressources:"); ?>
    <?php echo elgg_view('input/pulldown', array('internalname'=>'ressource', 'options_values'=>$vars['titles']));?>


But I don't manage to have the right guid for each title to be inserted as value. I want to arrive to that:

<option value="guid">title</option>


So, how to do it? I've tried a lot of things, I've read many topics without finding my answer.


Thanks in advance


Nevermind, I've tried again one of the solutions I've found and this time, it has worked -_-'.


The solution is:

foreach ($ressources as $r){

$titles[$r->guid] = $r->title;