Reputation: 72
I tried to play the songs and pass the dynamic id to the controller.But I tried this code.
<?php
$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 anchor shows the direct 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 is correct?
Upvotes: 0
Views: 41
Reputation: 7111
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>";
}
Upvotes: 1