title: how to have button in every value
body: <blockquote>
    <p>i tried this code. but there are only one x button and it delete only the first value i want every
    value that has been bold have x button.and  what should i do ? . the
    picture show below the example. Thankyou in advance,</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/JqzXy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JqzXy.jpg" alt="enter image description here"></a>
       
  
  <pre><code>if ($specializations = selected_specializations()) {
  
      $groupped_spec = [];
      $groupped_pcon = [];
      foreach ($specializations as $specialization) {
          $spec  = $specialization["Specialization"];
  
          $groupped_pcon[$spec][] = $specialization["PossibleCondition"];
          $groupped_spec[$spec][] = array_only($specialization, ['id', 'Specialization', 'Specialization1', 'Specialization2']);
      }
  
      foreach ($groupped_spec as $Specialization =&gt; $groupped_specializations) {
          $PossibleCondition = implode("&lt;br /&gt;", array_unique($groupped_pcon[$Specialization]));
  
          echo "      &lt;b&gt;{$PossibleCondition}&lt;/b&gt;&lt;br /&gt;\n";
  
          foreach (array_unique_arrays($groupped_specializations, ['id']) as $specialization) {
              $id    = $specialization["id"];
              $spec  = $specialization["Specialization"];
              $spec1 = $specialization["Specialization1"];
              $spec2 = $specialization["Specialization2"];
  
              ?&gt;
              &lt;button class="btn btn-link" name="delete_spec" aria-label="Left Align" data-id="&lt;?php print $id;?&gt;"&gt;
                  &lt;span class="glyphicon glyphicon-remove"&gt;&lt;/span&gt;
              &lt;/button&gt;
  &lt;ul&gt;
              &lt;a href="hgapp.php?doc=&lt;?php echo $spec  ?&gt;"&gt;&lt;u&gt;&lt;?php echo $spec  ?&gt;&lt;/u&gt;&lt;/a&gt;
              &lt;a href="hgapp.php?doc=&lt;?php echo $spec1 ?&gt;"&gt;&lt;u&gt;&lt;?php echo $spec1 ?&gt;&lt;/u&gt;&lt;/a&gt;
              &lt;a href="hgapp.php?doc=&lt;?php echo $spec2 ?&gt;"&gt;&lt;u&gt;&lt;?php echo $spec2 ?&gt;&lt;/u&gt;&lt;/a&gt;
              &lt;/ul&gt;
              &lt;?php
          }
  
  ?&gt;
  
  
  &lt;?php
  
          }
  
      }
  ?&gt;
  
  &lt;/div&gt;
  
  &lt;script type="template" id="specialization_group_template"&gt;
      &lt;b&gt;{PossibleCondition}&lt;/b&gt;&lt;br /&gt;{specializations}&lt;br /&gt;
  
  &lt;/script&gt;
  
  
  &lt;script type="template" id="specialization_template"&gt;
      &lt;button name="delete_spec"class="btn btn-link" aria-label="Left Align" data-id="{id}"&gt;
          &lt;span class="glyphicon glyphicon-remove" aria-hidden="true"&gt;&lt;/span&gt;
      &lt;/button&gt;
  &lt;ul&gt;
      &lt;a href="hgapp.php?doc={Specialization}"&gt;&lt;u&gt;{Specialization}&lt;/u&gt;&lt;/a&gt;
      &lt;a href="hgapp.php?doc={Specialization1}"&gt;&lt;u&gt;{Specialization1}&lt;/u&gt;&lt;/a&gt;&lt;br&gt;
      &lt;a href="hgapp.php?doc={Specialization2}"&gt;&lt;u&gt;{Specialization2}&lt;/u&gt;&lt;/a&gt;
      &lt;/ul&gt;
  &lt;/script&gt;
  </code></pre>