View Full Version : echo an anchor and href with PHP variables

03-04-2010, 11:37 PM

i am echoing a table on a page, and a typical line looks like this:
echo '<tr>';
echo '<td align="center"><a href="movies/"' . $log[$i] .
substr($log[$i], 0, strpos($log[$i], "-") - 2) . '".avi">' . $log[$i] . '</a></td>';
echo '</tr>';this sample code is pulling the value $log[$i] which is equal to: last house on the left - 456mb

my hyperlink echoes fine, but the address comes out as: www.mydomain/movies/. the PHP variables aren't being read. I have also tried to put the vars inside the double quotes with the HREF, to no avail. not sure what to try next. can someone give me a push here? thanks!

03-05-2010, 12:07 AM
echo '<tr>';
echo '<td align="center"><a href="movies/' . $log[$i] .
substr($log[$i], 0, strpos($log[$i], "-") - 2) . '.avi">' . $log[$i] . '</a></td>';
echo '</tr>';