title: Make select tag required if quantity is selected
body: <p>What I wan't to achieve is when you have selected how many windows you have, but not have chosen what option you wan't, it should either give a error message or just set <code>Option 1</code> as the default when you submit the form.</p>
  <p>I didn't post all of the code, because there is 31 windows that you can choose from, so it would be a very long question, so I just posted code for one window.</p>
  <p>What I have tried so far:</p>
  <ul>
  <li><p>I have given the <code>Option 1</code> the <code>selected</code> attribute, but then it's applied all the time, when you submit the form and that's not how it supposed to be.</p>
  </li>
  <li><p>I have tried to give the <code>&lt;input type=&quot;number&quot; name=&quot;quantity1&quot; min=&quot;0&quot; max=&quot;100&quot; placeholder=&quot;STK.&quot;&gt;</code> the same php code as the <code>Option 1</code> so it would be like this:</p>
  <p><code>&lt;input type=&quot;number&quot; name=&quot;quantity1&quot; min=&quot;0&quot; max=&quot;100&quot; placeholder=&quot;STK.&quot; value=&quot;60|Vindue 1&quot; &lt;?php if(isset($_POST[ 'quantity1']) &amp;&amp; $_POST[ 'window1']=='60' ){ echo 'selected'; } else { echo ''; } ?&gt;&gt;</code> but then again it will always display the value of <code>Option 1</code> even if you didn't chose it</p>
  </li>
  </ul>
  <p>HTML and PHP for where you choose option, quantity and submit the form:</p>
  <pre><code>    &lt;form action=&quot;&quot; method=&quot;post&quot;&gt;
  
      &lt;div class=&quot;dropdown-option&quot;&gt;
          &lt;select id=&quot;select&quot; name=&quot;window1&quot; value=&quot;window1&quot;&gt;
              &lt;option&gt;Choose Option&lt;/option&gt;
              &lt;option value=&quot;60|Window 1&quot; &lt;?php if(isset($_POST[ 'window1']) &amp;&amp; $_POST[ 'window1']=='60' ){ echo 'selected'; } else { echo ''; } ?&gt;&gt;Option 1&lt;/option&gt;
              &lt;option value=&quot;40|Window 1&quot; &lt;?php if(isset($_POST[ 'window1']) &amp;&amp; $_POST[ 'window1']=='40' ){ echo 'selected'; } else { echo ''; } ?&gt;&gt;Option 2&lt;/option&gt;
              &lt;option value=&quot;40|Window 1&quot; &lt;?php if(isset($_POST[ 'window1']) &amp;&amp; $_POST[ 'window1']=='40' ){ echo 'selected'; } else { echo ''; } ?&gt;&gt;Option 3&lt;/option&gt;
              &lt;option value=&quot;85|Window 1&quot; &lt;?php if(isset($_POST[ 'window1']) &amp;&amp; $_POST[ 'window1']=='85' ){ echo 'selected'; } else { echo ''; } ?&gt;&gt;Option 4&lt;/option&gt;
          &lt;/select&gt;
      &lt;/div&gt;
      &lt;div class=&quot;quantity-field&quot;&gt;
          &lt;input type=&quot;number&quot; name=&quot;quantity1&quot; min=&quot;0&quot; max=&quot;100&quot; placeholder=&quot;STK.&quot;&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;row&quot;&gt;
          &lt;h3 style=&quot;text-transform: uppercase;padding-bottom:70px;&quot;&gt;Indtast dine oplysninger og modtag dit uforpligtende tilbud!&lt;/h3&gt;
  
          &lt;div class=&quot;large-6 small-12 columns&quot;&gt;
              &lt;label for=&quot;first_name&quot;&gt;Fornavn *&lt;/label&gt;
              &lt;input class=&quot;&quot; name=&quot;first_name&quot; id=&quot;first_name&quot; type=&quot;text&quot; required /&gt;
          &lt;/div&gt;
  
          &lt;div class=&quot;large-6 small-12 columns&quot;&gt;
              &lt;label for=&quot;last_name&quot;&gt;Efternavn *&lt;/label&gt;
              &lt;input class=&quot;&quot; name=&quot;last_name&quot; id=&quot;last_name&quot; type=&quot;text&quot; required /&gt;
          &lt;/div&gt;
  
          &lt;div class=&quot;large-5 columns&quot;&gt;
              &lt;label for=&quot;address_street&quot;&gt;Adresse *&lt;/label&gt;
              &lt;input class=&quot;&quot; name=&quot;address_street&quot; id=&quot;address_street&quot; type=&quot;text&quot; required /&gt;
          &lt;/div&gt;
  
          &lt;div class=&quot;large-2 columns&quot;&gt;
              &lt;label for=&quot;zip_code&quot;&gt;Postnummer *&lt;/label&gt;
              &lt;input class=&quot;&quot; name=&quot;zip_code&quot; id=&quot;zip_code&quot; type=&quot;number&quot; required /&gt;
          &lt;/div&gt;
  
          &lt;div class=&quot;large-5 columns&quot;&gt;
              &lt;label for=&quot;city&quot;&gt;By *&lt;/label&gt;
              &lt;input class=&quot;&quot; name=&quot;city&quot; id=&quot;city&quot; type=&quot;text&quot; required /&gt;
          &lt;/div&gt;
  
          &lt;div class=&quot;large-6 small-12 columns&quot;&gt;
              &lt;label for=&quot;email_address&quot;&gt;Email *&lt;/label&gt;
              &lt;input class=&quot;&quot; name=&quot;email_address&quot; id=&quot;email_address&quot; type=&quot;email&quot; required /&gt;
          &lt;/div&gt;
  
          &lt;div class=&quot;large-6 small-12 columns&quot;&gt;
              &lt;label for=&quot;mobile_no&quot;&gt;Telefon *&lt;/label&gt;
              &lt;input class=&quot;&quot; name=&quot;mobile_no&quot; id=&quot;mobile_no&quot; type=&quot;tel&quot; maxlength=&quot;8&quot; required /&gt;
          &lt;/div&gt;
  
          &lt;div class=&quot;large-12 columns&quot;&gt;
              &lt;label for=&quot;textarea&quot;&gt;Besked&lt;/label&gt;
              &lt;textarea name=&quot;textarea&quot; id=&quot;&quot; cols=&quot;30&quot; rows=&quot;10&quot;&gt;&lt;/textarea&gt;
          &lt;/div&gt;
  
          &lt;div class=&quot;large-12 columns text-center&quot;&gt;
              &lt;input type=&quot;submit&quot; name=&quot;submit&quot; style=&quot;font-family: 'Dosis' !important;&quot; value=&quot;Recieve and offer&quot; class=&quot;submit-pris&quot;&gt;
          &lt;/div&gt; 
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  <p>Is PHP the right way or can this be done with jQuery?</p>
  <p>I hope that someone can help me with this issue, thanks in advance! :)</p>