<a href="this is a format problem">"'&q

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
theclay7
Forum Commoner
Posts: 50
Joined: Wed Feb 19, 2003 3:17 am

<a href="this is a format problem">"'&q

Post by theclay7 »

'http://www.cnn.com

if I insert <a href='http://www.cnn.com> Without closing quote </a>

my code will die and as you may see from the above code, what I want to do is

1) if I have a ' before http:// , it will turn into htmlspecialchars

2) how do i count/extract everything within [URL.....[/URL] ?


another question....

I have a hidden code that will embedded with with user's message, say if the user type "hello", it acutally is

"<!--DO NOT REMOVE THIS## <B> date()--> hello <!--DO NOT REMOVE THIS ## </B>-->"

and the whole thing will be inserted into the database

i want to remove everything EXCEPT "hello"
when the USER want to "EDIT" the message....

how can I do that?
http://www.cnn.com
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

One way would be to use explode or any combination of the string-functions.

To my mind a cleaner (but more complicated, yet more powerful) solution would be using regular expressions, i.e. preg_match or preg_match_all.

I don't have a regEx for URLs handy - there are plenty of regEx-collections available online, though - and they always need to be indiviually adapted to the task at hand.
Post Reply