title: How to get id from URL in codeigniter?
body: <p>I am trying to get 'id' from URL in order to delete that specific selected product. I have used <code>$this-&gt;uri-&gt;segment(3)</code> but its not getting any value from URL. Although i can see the 'product_id' in my URL.</p>
  
  <p>If i used <code>$this-&gt;url-&gt;segment(2)</code> it gives me the second value form URL, but i am unable to get product Id.
  Following is my code. Kindly guide me.</p>
  
  <p><strong>VIEW</strong></p>
  
  <pre><code>echo "&lt;a href='delete_controller?product_id=$product_id'&gt;";
  echo $name;
  echo "&lt;/a&gt;";
  </code></pre>
  
  <p>The following URL is generating when i click on $name.</p>
  
  <pre><code>http://localhost/designs2/index.php/products_controller/delete_controller?product_id=70
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>public function delete_controller()
      {
          echo $product_id =$this-&gt;uri-&gt;segment(3);           
          echo "Taha";
          $this-&gt;load-&gt;view('delete_confirmation');
      }
  </code></pre>