I'm trying to present hyperlinks on my webpage using CodeIgniter's base_url() and concatenation.
$i = 1;
foreach ($view as $row) {
echo "<tr>";
echo "<td>" . $i . "</td>";
echo "<td>" . "<a href='<?php echo base_url();?>admin/play/$row->audio'" . $row->audio . "</a></td>";
$i++;
echo "</tr>";
}
In inspecting the element, the anchor shows some raw PHP code instead of localhost/bla/bla/. How can I fix this?
My controller name is play and I want to pass the value of its the particular name.
Is my concatenation correct?
You are opening php tags twice. make it like this:
<?php
$i = 1;
foreach ($view as $row)
{
echo "<tr>";
echo "<td>".$i."</td>";
echo "<td><a href='" . base_url('admin/play' . $row->audio) . "'>" . $row=>audio . "</a><td>";
$i++;
echo "</tr>";
}