|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
remove tags
Hi guys,
currently in my database, i have a column where they store bookmark html code e.g: <a name="dddda"></a> actually i wanna remove all all the html tags and only display the ddda in a textfield to the user.. the prob is how can i remove the html bookmark tags ? I did think of using strip_tags function.. but what should i put at the end of the function ? is it <a name=""></a> ?? this doesn't make sense to me.. is there any other way i can do this ? PLease advise. |
|
#2
|
|||
|
|||
|
What I would do is I would use PHPMyAdmin to export that table to a file, open that file in a text editor and do Replace <a name=" with nothing. Then run the Replace again, this time replacing "></a> with nothing.
Save the file, then in PHPMyAdmin run that file as SQL. And voilą... Hope this helps, Toine |
|
#3
|
|||
|
|||
|
I want to show the value of the row to the users(except the html code) and not edit by myself..
any idea ? |
|
#4
|
||||
|
||||
|
Although it may be too late for this suggestion, but re-designing your table might be a good option...
For example, a table called "Bookmarks" with the fields "url" and "label"... Other than that, I suppose there's way to strip the attributes out of HTML using an XML parser (pre-built into PHP) Reference: http://ca2.php.net/manual/en/ref.xml.php From what I understand, the strip_tags function will simply strip any existence of <tag> in a string... You can't extract information before it does so. |
|
#5
|
||||
|
||||
|
I took the liberty of creating some code to parse the HTML...
I made a basic parser that will strip the value of the HREF attribute in the A tag... This is basic stuff, read the reference link i provided in my previous post for some further examples. PHP Code:
Note, to put the value in a text field, change the print line within the startElement function to the following: print ("<input type='text' value='".$attrs['HREF']."' size='50'>"); |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > remove tags |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|