Page 1 of 2

html LINK tag <a href> </a> do not work fine

Posted: Thu Aug 19, 2004 3:56 am
by duk
hy ppl

i have a litle form to post some news into a website... but when i try to sert a link to a web page with html tags... like this :

<a href="url?sapo.pt" > here </a>

the link not apear in the post...

i use just nl2br in the variable... nothing more...

why this happen ?

Posted: Thu Aug 19, 2004 4:15 am
by markl999
Do a 'view source' on the resulting page and see what the html around the word 'here' looks like.

Posted: Thu Aug 19, 2004 4:28 am
by duk
doesn't apear anything...

i try... <a href="page?sapo.pt" > here </a> the text "here" doesn't apear...

but if i use tags like <b> or <I> other tags works fine but this <a href=">?sapo.pt" </a> doesn't work...

Posted: Thu Aug 19, 2004 4:54 am
by markl999
I'm presuming you're storing it in a database first? Is it going into the db ok? If so, what does the text look lik in there?

Posted: Thu Aug 19, 2004 4:59 am
by duk
yes is stored in a mysql db,

in the table, the text apears fine...

Posted: Thu Aug 19, 2004 5:01 am
by markl999
Weird, i can't see why pulling some text from a db then passing it via a nl2br() would remove an entire <a href="...">here</a> string unless there's some strip_tags() or quote escaping going on, even then it would leave you something and not remove the enitre string.
Maybe post the code you are using to pull/display the info from the database?

Posted: Thu Aug 19, 2004 5:04 am
by duk
i don't understand your question,

Maybe post the code you are using to pull/display the info from the database?

??? can you use other words...

Posted: Thu Aug 19, 2004 5:06 am
by markl999
On your news page where the link is dissappearing, post the code you are using that queries the database, does the nl2br() and displays the post.

Posted: Thu Aug 19, 2004 5:14 am
by duk
code in db:

see this pages ppl:

link1: <a href=url>here</a>
link1: <a href=url>here</a>

etc...

-----------------------------

to display

$news = nl2br("$news");

echo "$news";

just like this..

Posted: Thu Aug 19, 2004 5:59 am
by JayBird
Show us ALL your code and read this viewtopic.php?t=21171

Posted: Thu Aug 19, 2004 8:10 am
by duk
its very simple

Code: Select all

<?php

$post = $_POST["news"];

//$post have for example

//hy ppl see this
//<b><a href="url>here</a><b>?sapo.pt"



$insert = "insert into news (post) values ('$post')";

$exec = mysql_db_query("sb", $insert);

//ok at here, you have put the variable $post into the database


?>



now lets see the $post...

Code: Select all

<?php

//inside db we have

//hy ppl see this<br />
//<br />
//<b><a href="url>here</a><b><br?sapo.pt" />
//<br />


$cmd = "select post from news";
$exec = mysql_db_query("db", $cmd);

$get = mysql_fetch_row($exec);

$post_news = $get[0];


$post_news = nl2br("$post_news");

echo "

         <b>$post_news</b>

";

// the text "here" will not apear in the html 


?>

Posted: Thu Aug 19, 2004 8:16 am
by qads

Code: Select all

<b><a href="url>here</a><b><br?sapo.pt" />
if thats how your making a link then no wonder its not working..

use this...

Code: Select all

<b><a href="URL HERE">display text</a></b>

Posted: Thu Aug 19, 2004 8:19 am
by duk
if you are saying, i miss the " "" ??? yes i miss it but just in this post, in the db is correct...

that is not the problem, sometimes i do not put any " " "[/b]

Posted: Thu Aug 19, 2004 8:26 am
by qads
lol...ok, do us all a favor and...

1) paste the data from db....
2) paste your code to display the data..
3) paste your code to insert your data..

Posted: Thu Aug 19, 2004 8:49 am
by duk
i already put it...

is that the way, but in my code i just use other portuguese words...

and the data in the db is the same