php - how to pass row id in href of a tag in codeigniter controller? -


i using jqxgrid in codeigniter display records mysql database. while displaying data, made column named 'action' contains edit 'a' tag redirect page editing specific record. need assign id href attribute in order that. can't correctly that.

in controller, tax.php:

foreach($result $row){    $data[$i]['tax_id']=$row['tax_id'];    $data[$i]['tax_name']=$row['tax_name'];    $data[$i]['action']='<a href="<?php echo base_url()?>/edit_tax/$row["tax_id"];">edit</a>';    $i++; } 

how can correctly assign tax_id url?

i believe have evaluate $row["tax_id"] php expression:

$data[$i]['action']='<a href="<?php echo base_url()?>/edit_tax/<?php echo $row["tax_id"]; ?>">edit</a>'; 

edit: use php's string concatenation construct <a> element:

$data[$i]['action']='<a href="' . base_url() . '/edit_tax/' . $row["tax_id"] . '">edit</a>'; 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -