tags:

views:

228

answers:

3

**this Line not work properly /r work but $siteurl/%s-%s.html not work i think problem of ("") or ('') please help me to repair it

printf("<a href='/r?%s' target=_blank onClick='window.open(location.href=$siteurl/%s-%s.html)>", $wurl, $myrow["wallpaperid"], $myrow["wallpapername"]);
+1  A: 

Your onClick attribute misses the trailing single quote. Here's what I think it should be:

printf("<a href='/r?%s' target=_blank onClick='window.open(location.href=$siteurl/%s-%s.html)'>", $wurl, $myrow["wallpaperid"], $myrow["wallpapername"]);

BTW: I had a hard time reading even this single line. Consider indenting your code to make it human-readable. Also, I recommend against using variable substitution (the $siteurl var in your string) when you are using printf anyway. I mean, use the same mechanism to do the same thing. Either use only var substitution, or use only printf formattng, not both. Example:

$html = '
    <a  href="/r?%s" 
        target=_blank 
        onClick="window.open(location.href=%s/%s-%s.html)"
    >
';
printf($html, $wurl, $siteurl, $myrow["wallpaperid"], $myrow["wallpapername"]);
Roland Bouman
A: 

You're missing a single quote mark after .html)

Try:

printf("<a href='/r?%s' target=_blank onClick='window.open(location.href=$siteurl/%s-%s.html)'>", $wurl, $myrow["wallpaperid"], $myrow["wallpapername"]);
MichaelRushton
A: 

I need to use this But its also not work Please Fix it for me

$html = '
       <a href="/r?%s" onClick="location.href="%s/%s-%s.html";" target=_blank title="Visit Related Sites"><img border=0 src="images/e.gif" width=100 height=75></a>';
    printf($html, $wurl, $siteurl, $myrow["wallpaperid"], $myrow["wallpapername"]);
Hassan