Note that there are some explanatory texts on larger screens.

plurals
  1. POSelecting html select list from sql database
    primarykey
    data
    text
    <p>I kind if have an interesting question. I'm trying to prefill an edit form in codeignitert. I have most of the values coming through the database, but my select box is giving me a few issues. I want it to only highlight what they had previously selected not erase the list and fill it in with what they selected...if that makes any sence.</p> <p>Here is my html</p> <pre><code>&lt;?foreach($info as $row) :?&gt; &lt;select multiple="multiple" class="multi" name="wGenre[]"&gt; &lt;option value="Action/Adventure"&gt;Action/Adventure&lt;/option&gt; &lt;option value="Angst"&gt;Angst&lt;/option&gt; &lt;option value="Crime"&gt;Crime&lt;/option&gt; &lt;option value="Drama"&gt;Drama&lt;/option&gt; &lt;option value="Family"&gt;Family&lt;/option&gt; &lt;option value="Fantasy"&gt;Fantasy&lt;/option&gt; &lt;option value="Friendship"&gt;Friendship&lt;/option&gt; &lt;option value="General"&gt;General&lt;/option&gt; &lt;/select&gt; &lt;?endforeach;?&gt; </code></pre> <p>I've already tried a couple of things. I have tried putting the list in a inner for loop and trying to select what comes back through the echo, but that only threw me errors. I could do an individual if statement for each item, but I shortened the list above and have another just like it and that seems like an unnecessary amount of code.</p> <p>If it helps, when I echo back the entire list it comes back as a string, like this. Fantasy Friendship General and I do have full text searching enabled.</p> <p>Thank you in advance for any help! :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload