Select Boxes
Permalink
I'm trying to build a block which in add and edit mode shows a select box which takes book titles from the controller's table and displays the relevant database field data in view mode.
The select box is working but when I select something in add or edit mode view simply displays nothing.
the code to get the title values from the table
the code to display the selection box
Code for view.php
The select box is working but when I select something in add or edit mode view simply displays nothing.
the code to get the title values from the table
public function getTitles(){ $db = loader::db(); $res = $db -> Execute('select title from btBookInfo'); $titles = array(); foreach($res as $row) { $titles[] = $row['title']; } return $titles; }
the code to display the selection box
Code for view.php