how do you make a hyperlink in php?
Moderator: General Moderators
-
PHPNEWBIE123
- Forum Newbie
- Posts: 1
- Joined: Fri Nov 05, 2010 11:17 pm
how do you make a hyperlink in php?
Ok so here's what iam doing. I have a premade site template that is made of mysql and php. Iam trying to edit it. In the backend of the site i can upload data. so iam uploading a domain name. The domain name is showing up on the site from the database. But how can i make it an active hyperlink? Remember the link would change evrytime for every different page depending on what i uploaded to the database
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: how do you make a hyperlink in php?
Usually displaying database values looks something like this:
Code: Select all
<?php
// using double quotes
echo "<a href=\"{$row['url']}\">{$row['name']}</a>";
// using single quotes
echo '<a href="' . $row['url']. '">' . $row['name'] . '</a>';
?>
<!-- or you can embed PHP tags in HTML -->
<a href="<?php echo $row['url']; ?>"><php echo $row['name']; ?></a>(#10850)