Insert certain tag attributes in user input in php

akiraphan

New Member
I am taking post as input from user. User can input \[code\]<a href=""></a>\[/code\] tag in the post. What I need to do is, if any user input any \[code\]<a>\[/code\] tag then I have to insert a class like \[code\]<a class="user" href=""></a>\[/code\] and save to database.How can I do this easy way? I am using \[code\]strip_tags()\[/code\] to remove all tags except \[code\]<a>\[/code\] in user input.
 
Top