Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Many to many with Form::Select()
  • Hey, I'm new to Fuel and I stumbled upon something I can't seem to solve by myself... Relationship:
    - Artists can have many Albums
    - Albums can have many Artists I have a many to many relationship and I'm trying to select the saved value on a Form::select() control in edit mode but I can't do it. I'm setting a global to pass the data to the dropdownlist
    // Controller
    $this->template->set_global('albums', Arr::assoc_to_keyval(Model_Album::find('all'), 'id', 'title'));
    
    // View
    <?php echo Form::select('albums', Input::post('albums', isset($artist) ? $artist->albums->title : '', $albums)); ?>
    

    Anyone who knows what I'm missing? I'd really appreciate some help!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!