i am trying to pass an id to a controller through url but the problem is it gives me the id field null
result of the edit link is like
"localhost/home71/project_management/index.php/boq_account/edit?id="
$url=base_url();
echo "<td id='edit'><a href='$url project_management/index.php/boq_account/edit?id='$n->id''>Edit</a></td>";
i have tried so many ways but not getting any result.one thing to mention that my $n->id is not null it has values but its not showing on the passing id parameter.
Try like this-
echo "<td id='edit'><a href='$url project_management/index.php/boq_account/edit?id=".$n->id."'>Edit</a></td>";
Try with this,
echo "<td id='edit'><a href='$url project_management/index.php/boq_account/edit?id='".$n->id."'>Edit</a></td>";
Try something as below:
echo '<td id="edit"><a href="'.$url.'project_management/index.php/boq_account/edit?id='.$n.'">Edit</a></td>';
You have too many single quotes near $n->id. Try something like this:
echo "<td id='edit'><a href='$url project_management/index.php/boq_account/edit?id=$n->id'>Edit</a></td>";
If you're sure you have data in $n->id
, use PHP's urlencode()
as you're passing it to <a>
.
Here's how:
echo "<td id='edit'><a href='$url project_management/index.php/boq_account/edit?id=".urlencode($n->id)."'>Edit</a></td>";