Page 1 of 1
(solved)display url links using forms
Posted: Mon Aug 22, 2005 9:52 am
by lostinphp
hi people...
someone please help me out here.
i have a form wid a textbox..when i enter a url into it during run time i want it to appear as a link..as in i shud be able to click on it and visit the url.
i also have a sql database where this url will be stored..everything is working fine except i dont know how to display a link using a form display.
thanks in advance
Posted: Mon Aug 22, 2005 9:56 am
by feyd
you want the text, while inside the textbox, to show up as a link, or you want the text, after submission, to show as a link?
after
Posted: Mon Aug 22, 2005 9:58 am
by lostinphp
after submission
Posted: Mon Aug 22, 2005 10:03 am
by feyd
quickly looking at the Regex board:
viewtopic.php?t=36176
Posted: Mon Aug 22, 2005 10:08 am
by lostinphp
thank u but where do i include this piece of code?
Posted: Mon Aug 22, 2005 10:23 am
by nickman013
i think you place it in the processor script. i can be wrong though.

Posted: Mon Aug 22, 2005 10:39 am
by lostinphp
i have a submit.php where i have the form where i can enter the url
and a view.php to execute the display.so at which point shud i do function addlink so dat the text entered in the text box is clickable when it is displayed using view.php
i hope im makin myself clear.
thank u.
Posted: Mon Aug 22, 2005 10:50 am
by lostinphp
is there any way to define the particular field called links in sql as a link?
Posted: Tue Aug 23, 2005 4:04 am
by lostinphp
isnt there any other solution?
Posted: Tue Aug 23, 2005 5:17 am
by lostinphp
isnt working yet.
does someone have a better suggestion?
Posted: Tue Aug 23, 2005 7:21 am
by feyd
inline link parsing is typically done on view request.
Posted: Wed Aug 24, 2005 3:04 am
by lostinphp
feyd wrote:inline link parsing is typically done on view request.
will u please explain wat u mean by dat? im completely lost,

Posted: Wed Aug 24, 2005 7:18 am
by feyd
you run the function on the text just before sending it to a user.
Posted: Wed Aug 24, 2005 7:33 am
by lostinphp
feyd wrote:you run the function on the text just before sending it to a user.
thank u but i tried this and it works thanks to pimptastic who suggested it.
Code: Select all
$query = "SELECT links FROM homepage WHERE text='$text'";
$result = mysql_query($query) or die(mysql_error());
if(mysql_num_rows($result) == 0) {
echo "There are no links in the database.";
} else {
while ($links = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<a href="'.$links['links'].'" target="_blank">'.$links['links'].'</a><br />';