Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder ajetrumpet's Avatar
    Join Date
    Jul 2009
    Location
    Iowa City, IA
    Posts
    407
    Thanks
    44
    Thanked 5 Times in 5 Posts

    echo an anchor and href with PHP variables

    all,

    i am echoing a table on a page, and a typical line looks like this:
    PHP Code:
        echo '<tr>';
        echo 
    '<td align="center"><a href="movies/"' $log[$i] . 
    substr($log[$i], 0strpos($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!

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    PHP Code:
    echo '<tr>'
        echo 
    '<td align="center"><a href="movies/' $log[$i] .  
    substr($log[$i], 0strpos($log[$i], "-") - 2) . '.avi">' $log[$i] . '</a></td>'
        echo 
    '</tr>'

  • Users who have thanked Nightfire for this post:

    ajetrumpet (03-04-2010)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •