I have produced a widget and I have to permit the user to choose from a number of options. The choices are books originating from another table within the database.
I am attempting to use code such as this:
<input type="text" name="<?PHP $this->get_field_name("books"); ?>">
However this fails when attempting in order to save. Could it be even easy to pass a range of options such as this and save them? Otherwise, an amount be a different. I possibly could pass values such as this:
book1 book2 book3
Basically do that I'd need to have a loop within the update method undergo all of the books within the database to determine which is checked and what is not? I am available to suggestions.
I'd make a move such as this:
First, keep options and pick them being an array:
$options = get_option("pluginName_books"); update_option("pluginName_books",$_REQUEST['books']);
Make use of this because the area inside your form:
<input type="text" name="books" value="the_value">
or to get it done like a checkbox:
<input type="checkbox" name="<?PHP $this->get_field_name("books"); ?>">