Page 1 of 1

how do you make a hyperlink in php?

Posted: Fri Nov 05, 2010 11:23 pm
by PHPNEWBIE123
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

Re: how do you make a hyperlink in php?

Posted: Sat Nov 06, 2010 12:05 am
by Christopher
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>