title: How to bring on second condition input form when selected dropdown item in PHP
body: <p><strong>Task:</strong></p>
  
  <p>To create a dropdown list for option values:"Name1...Name2...Name3...Others". Hence, when a user were to click on the option 'Others', it will generate an additional form fields for the user to enter and they are: "Name, Rego No., Address".</p>
  
  <p><strong>What has been done:</strong></p>
  
  <p>I have created the following dropdown list as shown:</p>
  
  <pre><code>&lt;p&gt;
  &lt;!--Input select box with options: Name1...Name2...Name3...Others--&gt;
  &lt;select name ="Name" id="NameDetails"&gt;
  &lt;option value ="0" selected = "selected"&gt; Select Name..&lt;/option&gt;
  &lt;option value ="Name 1"&gt; Name1&lt;/option&gt;
  &lt;option value ="Name 2"&gt; Name2&lt;/option&gt;
  &lt;option value ="Name 3"&gt; Name3&lt;/option&gt;
  &lt;option value = "Others"&gt; Others&lt;/option&gt;
  &lt;/select&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>Hence, the dropdown list is able to be shown. Furthermore, I have also created the html version for the 3 additional fields as shown below:</p>
  
  <pre><code>&lt;p&gt;
  &lt;input type="text" name="Name" id="Name" value="Name" title="Name" class="defaultValue required" tabindex="7" /&gt;
  &lt;div id="searchNameResultsContainer"&gt;&lt;/div&gt;
  &lt;div id="errorSearchNameResultsContainer" class="rounded errorSearchResultsContainer yui-ac-container"&gt;&lt;/div&gt;
  &lt;/p&gt;
  &lt;p&gt;
  &lt;input type="text" name="Rego No." id="Rego No." value="Reg No." title="Reg No." class="leftCol defaultValue required validateInput formatNumber" tabindex="8" /&gt;
  &lt;/p&gt;
  ....(Identical for "Address" field)
  </code></pre>
  
  <p><strong>Issue:</strong>
  At this point, I am stuck at how to call the additional 3 fields when users select 'Others' from the dropdown list. I have tried to use the "if..else" condition but am stuck when I tried to input the above code within if statement.</p>
  
  <p>Hence, could anyone please help? Thanks.</p>
  
  <p><strong>code edit:</strong></p>
  
  <pre><code>&lt;div&gt;
  &lt;p&gt;
  &lt;!--Input selectbox with options: Name1...Name2...Name3...Others--&gt;
  &lt;select name ="Name" id="NameDetails" onchange = "return val(this.value);"&gt;
  &lt;option value ="0" selected = "selected"&gt; Select Agency..&lt;/option&gt;
  &lt;option value ="Name 1"&gt; Name1&lt;/option&gt;
  &lt;option value ="Name 2"&gt; Name2&lt;/option&gt;
  &lt;option value ="Name 3"&gt; Name3&lt;/option&gt;
  &lt;option value = "Others"&gt; Others&lt;/option&gt;
  &lt;/select&gt;
  &lt;/p&gt;
  
  &lt;!-- Set Conditional check, if user clicks Others, direct to input field: Name,  Registration Number, Address--&gt;
  
  &lt;div id = "extradiv" style ="display:none"&gt;
  &lt;p&gt;
  &lt;input type="text" name="Name" id="Name" value="Name"  title="Name" class="defaultValue required" tabindex="7" /&gt;
  &lt;div id="searchNameResultsContainer"&gt;&lt;/div&gt;
  &lt;div id="errorNameCompanyResultsContainer" class="rounded errorSearchResultsContainer yui-ac-container"&gt;&lt;/div&gt;
  &lt;/p&gt;
  &lt;p&gt;
  &lt;input type="text" name="RegistrationNum" id="RegistrationNum" value="Registration Num" title="Registration Num" class="leftCol defaultValue required validateInput formatNumber" tabindex="8" /&gt;
  &lt;/p&gt;
  &lt;p&gt;
  &lt;input type="text" name="Address" id="Address" value="Address" title="Address" class="defaultValue required signupinput_txt" tabindex="9" /&gt;
  &lt;div id="searchAddressResultsContainer" class="hide searchResultsContainer"&gt;&lt;/div&gt;
  &lt;div id="errorSearchAddressResultsContainer" class="rounded errorSearchResultsContainer yui-ac-container"&gt;&lt;/div&gt;
  &lt;/p&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script&gt;
  function val(x)
  {
      if (x =="Others" )
      {
              document.getElementById("extradiv").style.display ="block";
      }else
      {
              document.getElementById("extradiv").style.display = "none";
      }
  }
  &lt;/script&gt;
  </code></pre>