Write href using php...?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
markwenham
Forum Newbie
Posts: 13
Joined: Fri Aug 16, 2002 11:33 pm

Write href using php...?

Post by markwenham »

When I try to use php to write an href link such as

Code: Select all

print  "<tr>
             <td><a href='$row&#1111;coWWW]' alt='$row&#1111;coWWW]'>$row&#1111;coName]</a></td>
       </tr>";
$row[coWWW] contains "www.msn.com", but the resulting link on the page
contains
http://localhost/www.msn.com

I am guessing that this is some sort of PHP ini variable - can anyone point
me in the right direction?

Thanks, Mark
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

if $row['coWWW'] does not cantain a leading "http://" then you need to add it yourself. otherwise the browser thinks its a relative url and not an absolute url.
markwenham
Forum Newbie
Posts: 13
Joined: Fri Aug 16, 2002 11:33 pm

Post by markwenham »

$row[coWWW] contains http://www.msn.com
the script is adding http://localhost to the front.
markwenham
Forum Newbie
Posts: 13
Joined: Fri Aug 16, 2002 11:33 pm

Post by markwenham »

Got it,
Thanks
Post Reply