My Flawed Algorithm: returns ($desired_result - 1) or ($desired_result + 1)
<p>I'm creating a script to add recipes to a database.  For my add_recipe form, I'd like to give users an option to add as many ingredients as they'd like.</p>

<p>The following code is just something I came up with for testing purposes, since I've never tried this before:</p>

<pre><code>&lt;?php
$ingredient = '(another ingredient)';
$num_ingredients = $_REQUEST['select'];
?&gt;
&lt;html&gt;
&lt;form name="form1" method="post" action="onchange.php"&gt;
&lt;select name="select" onchange="javascript: document.form1.submit();"&gt;
  &lt;option value=1&gt;Add 1 Ingredient&lt;/option&gt;
  &lt;option value=2&gt;Add 2 Ingredients&lt;/option&gt;
  &lt;option value=3&gt;Add 3 Ingredients&lt;/option&gt;
&lt;/select&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;?php
while ($num_ingredients &lt;= 3) {
  $num_ingredients++;
  echo $ingredient;
  echo '&lt;br /&gt;';
}
?&gt;
</code></pre>

<p>The problem is...my code, lol.  For example...</p>

<p>option value=1 returns:</p>

<pre><code>(another ingredient)
(another ingredient)
</code></pre>

<p>option value=3 returns:</p>

<pre><code>(another ingredient)
</code></pre>

<p>Can someone steer me in the right direction?  Any help is greaaaatly appreciated 8)</p>
