Re: inserting link into database
| From: | Philip Olson | Date: | Thu, 04 Jan 2001 08:16:21 +0000 |
| Subject: | Re: inserting link into database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32616@lists.php.net to get a copy of this message | ||
// So we have a form :
<form method="post" action="<?php print $PHP_SELF; ?>">
<br><input type="text" name="string">
<br><input type="submit" name="submit">
</form>
// And it creates a string
$string = '<a href="http://www.yahoo.com">yahoo</a>';
// And we use htmlspecialchars on it
$string = htmlspecialchars($string);
// And if we print it out
print $string;
// It prints <a href="http://www.yahoo.com">yahoo</a>
// Because it actually looks likes like this :
<a href="http://www.yahoo.com">yahoo</a>
htmlspecialchars() will work! Before entering into database run
htmlspecialchars on it and all will be good. Upon retrieval from database
the links will not appear as links but rather, typical HTML.
Regards,
Philip Olson
http://www.cornado.com/
On Thu, 4 Jan 2001, dean james wrote:
> Hello,
>
> How can I insert the following String into a database from a html form.
> Keep in mind that I need it to render exactly like a regular string as
> shown. So someone would enter that below. Basically, I am allowing html
> code.
>
> <a href="http://www.yahoo.com">yahoo</a>
>
> Basically, whenever I present this entry, it always has to look like that,
> not a link underlined etc... exactly as shown with brackets and slashes
> etc....
> It has to go into the database like that and retrieved and displayed like
> that... I have tried "htmlentities" & "htmlspecialchars" with minimal
> success (none)...ANY help is appreciated.
>
> Thanks,
> J
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
> http://explorer.msn.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>