Simple php problem HELP: inserting image inside the php code

Discussion in 'PHP' started by dhisky, Dec 1, 2009.

  1. #1
    Hello I have this code




    if ($seo_on == 0)

    { echo "<div align='center'><a href='{$site_url}/index.php?task=viewnew'><img src="template/images/newest.png" border="0" />View More Newest Videos</a></div>"; }

    else

    { echo "<div align='center'><a href='{$site_url}/new.html'><img src="template/images/newest.png" border="0" />View More Newest Videos</a></div>"; }




    I don't have error before but when I tried to put an image inside it (the bolded part) I got an error, I wonder if I put the image code wrong...


    Anyone? Thanks!
     
    dhisky, Dec 1, 2009 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    following should solve the problem.. Enclosing image src and border in single quotes solves the problem in this case..

    
    if ($seo_on == 0)
    {
    echo "<div align='center'><a href='{$site_url}/index.php?task=viewnew'><img src='template/images/newest.png' border='0' />View More Newest Videos</a></div>";
    }
    else
    {
    echo "<div align='center'><a href='{$site_url}/new.html'><img src='template/images/newest.png' border='0' />View More Newest Videos</a></div>";
    }
    
    Code (markup):
     
    mastermunj, Dec 1, 2009 IP
  3. dhisky

    dhisky Peon

    Messages:
    207
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks you very much! Fixed now!
     
    dhisky, Dec 2, 2009 IP
  4. ISellMyITKnowledge

    ISellMyITKnowledge Peon

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    btw if i can suggest you try Adobe product known as Adobe Dreamweaver CS4
    it is great for php's and editting them visual php in one click and fix code.. not always code is written as A+ style but it shure helps :) !
    just a suggestion.
     
    ISellMyITKnowledge, Dec 2, 2009 IP
  5. ham

    ham Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I use homesite, it's a pretty simple editor but has some nice tools and provides syntax highlighting for many different languages.
     
    ham, Dec 3, 2009 IP
  6. dhaval300

    dhaval300 Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    ya adobe dreamweaver cs4 is very good
     
    dhaval300, Dec 4, 2009 IP