(solved)display url links using forms

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
lostinphp
Forum Commoner
Posts: 44
Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.

(solved)display url links using forms

Post 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
Last edited by lostinphp on Wed Aug 24, 2005 7:31 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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?
lostinphp
Forum Commoner
Posts: 44
Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.

after

Post by lostinphp »

after submission
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

quickly looking at the Regex board: viewtopic.php?t=36176
lostinphp
Forum Commoner
Posts: 44
Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.

Post by lostinphp »

thank u but where do i include this piece of code?
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

i think you place it in the processor script. i can be wrong though. :roll:
lostinphp
Forum Commoner
Posts: 44
Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.

Post 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.
lostinphp
Forum Commoner
Posts: 44
Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.

Post by lostinphp »

is there any way to define the particular field called links in sql as a link?
lostinphp
Forum Commoner
Posts: 44
Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.

Post by lostinphp »

isnt there any other solution?
lostinphp
Forum Commoner
Posts: 44
Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.

Post by lostinphp »

isnt working yet.
does someone have a better suggestion?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

inline link parsing is typically done on view request.
lostinphp
Forum Commoner
Posts: 44
Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.

Post 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, :( :roll:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you run the function on the text just before sending it to a user.
lostinphp
Forum Commoner
Posts: 44
Joined: Wed Jul 27, 2005 5:10 am
Location: Paris,France.

Post 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 />';
Post Reply