Reply to Re: php / mysql statement not working for URL

Your name:

Reply:


Posted by J.O. Aho on 02/25/07 11:17

Ron wrote:
> I figured it out:
>
> o "<td class = \"aptbody\" width = 15%>";
> echo "<a href= ".stripslashes($row["location_url2"]).">Click
> here</a>";
> echo "</td>";
>
> forgot a couple of those pesky dots. :)
>
> Is there a better way of doing this?

"Click here" is quite non informing and proper html wants options to be
quoted (even if single quotes are accepted by standard, there are
browsers that has problem with it and it's better to double quote)

echo "<a
href=\"".stripslashes($row["location_url2"])."\".>".stripslashes($row["location_url1"])."</a>\n";

I do think adding the new line at the end of each line html that is
echoed is a really good thing to do, as you this way will easier see
things when you look at the html-source in the browser.

I'm not sure if you need stripslashes(), as those character that may
need that aren't allowed in an url, then you could use

echo <<<EOL
<td class="aptbody">
<a href="{$row['location_url2']}">{$row['location_url1']}</a>
</td>
EOL;

There ain't any point in using the width attribute in the td-tag, as you
are already using CSS and you can set the width in the CSS.

--

//Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация