title: How to populate text fields when radio button is clicked?
body: <p>I am creating a web page where there are two divs (billing details and shipping details). When the page is loaded, the billing details are automatically displayed and the shipping details remain empty. I have included two radio buttons which allows the user to choose whether or not the shipping details are the same as the billing details. If the user selects yes from the radio buttons then the same details should be displayed in the shipping details.
  Note: the details are stored in database are am using php to get the data displayed</p>
  
  <p>At the moment, I have only tried using </p>
  
  <pre><code>&lt;?php if(isset($_POST'[shipping'] == 'yes')){echo $fname} ?&gt;
  </code></pre>
  
  <p>on the first name field just to see if it is working, but i doesnt seem to work.</p>
  
  <pre><code>&lt;div id="leftprofile"&gt;
      &lt;form id="au" method="post" action="../../../coursework/coursework/scripts/checkout.php"&gt;
      &lt;fieldset class="billing"&gt;
          &lt;legend&gt;Billing Details&lt;/legend&gt;&lt;br /&gt;
          &lt;label for="fname" class="reglabel"&gt;First Name:&lt;/label&gt;
          &lt;input required name="fname" type="text" id="fname" value="&lt;?php echo $fname ?&gt;"/&gt;&lt;br /&gt;
          &lt;label for="lname" class="reglabel"&gt;Last Name:&lt;/label&gt;
          &lt;input required name="lname" type="text" id="lname" value="&lt;?php echo $lname ?&gt;"/&gt;&lt;br /&gt;
          &lt;label for="address" class="reglabel"&gt;Address:&lt;/label&gt;
          &lt;input required name="address" id="address" type="text" value="&lt;?php echo $address ?&gt;"/&gt;&lt;br /&gt;
          &lt;label for="town" class="reglabel"&gt;Town:&lt;/label&gt;
          &lt;input required name="town" id="town" type="text" value="&lt;?php echo $town ?&gt;"/&gt;&lt;br /&gt;
          &lt;label for="postcode" class="reglabel"&gt;Post Code:&lt;/label&gt;
          &lt;input required name="postcode" id="postcode" type="text" value="&lt;?php echo $postcode ?&gt;"/&gt;&lt;br /&gt;
          &lt;label for="phone" class="reglabel"&gt;Phone:&lt;/label&gt;
          &lt;input required name="phone" id="phone" type="text" value="&lt;?php echo $phone ?&gt;"/&gt;&lt;br /&gt;
          &lt;label for="email" id="EmailLabel" class="reglabel"&gt;E-mail:&lt;/label&gt;
          &lt;input required name="email" type="email" id="email" value="&lt;?php echo $email ?&gt;"/&gt;&lt;br /&gt;
      &lt;/fieldset&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  
  &lt;div id="rightprofile"&gt;
      &lt;form id="au" method="post" action="../../../coursework/coursework/scripts/checkout.php"&gt;
      &lt;fieldset class="billing"&gt;
          &lt;legend&gt;Shipping Details&lt;/legend&gt;&lt;br /&gt;
          &lt;form&gt;
              Same as billing address?
              &lt;input type="radio" name="shipping" id="yes" value="yes"&gt;Yes
              &lt;input type="radio" name="shipping" id="no" value="no"&gt;No&lt;br/&gt;
          &lt;/form&gt;
          &lt;label for="fname" class="reglabel"&gt;First Name:&lt;/label&gt;
          &lt;input required name="fname" type="text" id="fname" value="&lt;?php if(isset($_POST'[shipping'] == 'yes')){echo $fname} ?&gt;"/&gt;&lt;br /&gt;
          &lt;label for="lname" class="reglabel"&gt;Last Name:&lt;/label&gt;
          &lt;input required name="lname" type="text" id="lname" /&gt;&lt;br /&gt;
          &lt;label for="address" class="reglabel"&gt;Address:&lt;/label&gt;
          &lt;input required name="address" id="address" type="text" /&gt;&lt;br /&gt;
          &lt;label for="town" class="reglabel"&gt;Town:&lt;/label&gt;
          &lt;input required name="town" id="town" type="text" /&gt;&lt;br /&gt;
          &lt;label for="postcode" class="reglabel"&gt;Post Code:&lt;/label&gt;
          &lt;input required name="postcode" id="postcode" type="text" /&gt;&lt;br /&gt;
          &lt;label for="phone" class="reglabel"&gt;Phone:&lt;/label&gt;
          &lt;input required name="phone" id="phone" type="text" /&gt;&lt;br /&gt;
          &lt;label for="email" id="EmailLabel" class="reglabel"&gt;E-mail:&lt;/label&gt;
          &lt;input required name="email" type="email" id="email" /&gt;&lt;br /&gt;
      &lt;/fieldset&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>