title: Using value from foreach loop in output
body: <p>Perhaps this is a very basic question, but I couldn't find any appropriate answer after Googling, and I'm quite new to this. How can I parse the value from a PHP foreach loop into a url and make it a query string?</p>
  
  <p>Sounds unclear? Let me explain.</p>
  
  <p>So, here's my PHP code:</p>
  
  <pre><code>&lt;?php foreach ($results as $data){ ?&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;?php echo $data-&gt;emp_id; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $data-&gt;emp_name; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $data-&gt;emp_mobile_no; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;a href="&lt;?php echo base_url(); ?&gt;index.php/admin_logins/employee3"&gt;&lt;button id="button_edit"&gt;Edit&lt;/button&gt;&lt;/a&gt;&lt;/td&gt;
          &lt;td&gt;&lt;a href="&lt;?php echo base_url(); ?&gt;index.php/admin_logins/employee4"&gt;&lt;button id="button_delete"&gt;Delete&lt;/button&gt;&lt;/a&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;?php }?&gt;
  </code></pre>
  
  <p>Now, what I want to do is something like this:</p>
  
  <pre><code> &lt;td&gt;&lt;a href="&lt;?php echo base_url(); ?&gt;index.php/admin_logins/employee3/value of $data-&gt;emp_id"&gt;&lt;button id="button_edit"&gt;Edit&lt;/button&gt;&lt;/a&gt;&lt;/td&gt;
  </code></pre>
  
  <p>And, similarly, this as well:</p>
  
  <pre><code> &lt;td&gt;&lt;a href="&lt;?php echo base_url(); ?&gt;index.php/admin_logins/employee4/value of $data-&gt;emp_id"&gt;&lt;button id="button_delete"&gt;Delete&lt;/button&gt;&lt;/a&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Now, what's the proper way to do this? </p>