Select multi-select form from array <p>Here's the issue. I have a database column called pymnt_meth_pref, which contains a comma separated string of payment methods chosen from a multiselect form.</p> <pre><code>&lt;td&gt;Payment Methods Used:&lt;br /&gt; &lt;input type="checkbox" name="pyment_meth_pref[]" value="Cash"&gt;I can pay with cash.&lt;br /&gt; &lt;input type="checkbox" name="pyment_meth_pref[]" value="Check"&gt;I can pay by check.&lt;br /&gt; &lt;input type="checkbox" name="pyment_meth_pref[]" value="Credit Card"&gt;I can pay by credit card.&lt;br /&gt; &lt;input type="checkbox" name="pyment_meth_pref[]" value="Paypal"&gt;I can pay with Paypal.&lt;br /&gt; &lt;/td&gt; </code></pre> <p>This array is posted to a variable and turned into a comma separated string</p> <pre><code>if (isset($_POST['pyment_meth_pref'])) $pymntmethpref = implode(", ", $_POST['pyment_meth_pref']); if (isset($_POST['pyment_meth_acc'])) $pymntmethacc = implode(", ", $_POST['pyment_meth_acc']); </code></pre> <p>This is then inserted into the database as a comma separated string.</p> <p>What I would like to do, is take this string and apply the values to the original form when the user goes back to the form and 'pre-select' the checkboxes, indicating that the user has already selected those values previously, and keeping those values in the database if they choose to edit any other information in the form.</p> <p>I'm assuming this would need to be done with javascript but if there is a way to do it with PHP I'd rather do it that way. </p>