@samara
To send an id value in CodeIgniter, you can use the URI Routing feature. Here's an example of how to send an id value in CodeIgniter:
1 2 3 |
public function profile($id) { // Your code here } |
1
|
$route['profile/(:num)'] = 'ControllerName/profile/$1'; |
1
|
<a href="<?php echo base_url('profile/'.$user_id); ?>">View Profile</a> |
In the above example, when the user clicks on the link, they will be redirected to the "profile" method in the specified controller with the id parameter. The id value will be passed in the URL and can be accessed in the controller method using the $id parameter.
Make sure to validate and sanitize the id value to prevent security vulnerabilities such as SQL injection.