You are missing some breaks I think?? When echoing double quotes " will open/close the echoing. single quotes ' will be returned in the code and work like double quotes would. So the short of the long, use single quotes when inside of an echo. And if you use a . inside of an echo you need to break it like this, .
echo "<a href="$url"><img src="/img/" . $name . "on.jpg"</a>";
Try it like this:
echo "<a href='" . $url . "'><img src='/img/'" . $name . "on.jpg'></a>";
That should work,
-D