Inserting words between strings
<p>I am working on a PHP form that involves a multiselect checkbox. I want to load the options that were selected by the user into a string and echo it. I want to separate the options with commas and the word "and".</p>

<p>For example:<br>
If a user selects just Option 1, I want to echo "opt1".<br>
If a user selects Option 1 and Option 2, I want to echo "opt1 and opt2"<br>
If a user selects Option 1, Option 2, and Option 3, I want to echo "opt1, opt2, and opt3".</p>

<p><strong>Here is my HTML:</strong></p>

<pre><code>&lt;p&gt;&lt;b&gt;Product:&lt;/b&gt;&lt;br&gt;
&lt;INPUT NAME="product[]" TYPE="CHECKBOX" VALUE="opt1"&gt;
  Option 1&lt;BR&gt;
&lt;INPUT NAME="product[]" TYPE="CHECKBOX" VALUE="opt2"&gt;
  Option 2&lt;BR&gt;
&lt;INPUT NAME="product[]" TYPE="CHECKBOX" VALUE="opt3"&gt;
  Option 3&lt;BR&gt;
&lt;INPUT NAME="product[]" TYPE="CHECKBOX" VALUE="opt4"&gt;
  Option 4&lt;BR&gt;&lt;/p&gt;
</code></pre>

<p>Thanks for helping a PHP noob!</p>
