Current location: Hot Scripts Forums » Programming Languages » PHP » Can PHP place quotes around HTML attributes


Can PHP place quotes around HTML attributes

Reply
  #1 (permalink)  
Old 08-17-04, 02:53 AM
frdmsun frdmsun is offline
New Member
 
Join Date: Aug 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Can PHP place quotes around HTML attributes

Please Help - I have looked everywhere.

Is there a command or a function that will automatically place qoutes around HTML attributes that are in a PHP string

I have PHP pulling HTML from a database. I am striping all but the basic HTML tags from the code and sending it to Flash for disply. All works BUT Flash canot dispay HTML tags that do not have quotes around the attributes.

I would be grateful for any help

Sunny
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 08-17-04, 03:12 AM
darkfreak's Avatar
darkfreak darkfreak is offline
Newbie Coder
 
Join Date: Jun 2004
Location: Kuopio, Finland, Europe
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
Maybe you should use addslashes() before you put your html in your database. Then you can get it back right with stripslashes(). Of course, if you already have badly formatted html in your database, this won't help. Instead, you could probably make a function that seeks the html strings for '=' and quotes the word/value following it. In this case you should see the manual for different string functions, like explode(), strreplace() etc.

from PHP manual:

string addslashes ( string str)

Returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte).

string stripslashes ( string str)

Returns a string with backslashes stripped off. (\' becomes ' and so on.) Double backslashes (\\) are made into a single backslash (\).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP in HTML Pages? ZeoFateX PHP 19 01-04-06 07:42 PM
PHP results in HTML bayside PHP 6 06-27-04 11:31 PM
Can anyone help me ? (problem using php variables in html db insert code) chronic_ PHP 2 06-13-04 12:19 PM
general question about php and html timfoster PHP 3 05-17-04 01:29 PM
PHP script to parse HTML Skeleton Man Script Requests 2 10-05-03 09:41 PM


All times are GMT -5. The time now is 01:20 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.