Does anyone know anything about PHP/MySQL/HTML?

  • Thread starter Thread starter Bob Loblaw
  • Start date Start date
B

Bob Loblaw

Guest
I'm making a site in which the user inputs certain fields, one of them being website. In this field, the user inputs the URL of a site. I then have a table that displays all of the entries. How do I get the website field to display as a hyperlink (preferably with 'link' as the text instead of the entire URL)?
okay, but if I'm constructing the table from the mysql database using a where loop, how do I only get the site field to be formatted like that? Or can I do the format as soon as the site field is originally input to the database, and thus save the site as well as the format in the database?
 
Adding to the answer above me.

I'm assuming you mean that you want the user-entered URL to display as a link.
Say you have it stored in a variable '$link'.

This is how you output the link into the browser

<a href="<?php echo $link; ?>">Name of link</a>

Note that this has to be outside of PHP code (i.e. not between <?php ?> tags).

If you want to do this from within PHP using echo, its
echo "<a href=\"".$link."\">Name of link</a>";
 
Back
Top