close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Keeping image files out of textbox

Thread began 4/18/2011 3:29 pm by ijk76319396 | Last modified 4/19/2011 2:04 pm by Jason Byrnes | 1016 views | 4 replies |

ijk76319396

Keeping image files out of textbox

How do I implement this feature? I don't want users to be able to insert images into simple textboxes for commenting on my website. I know there is a strip tag feature however what program can I use to implement it?

Update: I have modified some of code to read ((isset($_POST["commentsbox"]))?(strip_tags($_POST["commentsbox"])):"") which keeps ALL tags out, however if I only want to keep certain tags such as image, how can I change that code above to handle this feature?

Sign in to reply to this post

ijk76319396

I have tried this line ((isset($_POST["comment"]))?(strip_tags ($str, "remove","<img>"($_POST["comment"]))):"") which doesn't work still. I am stuck here, any suggestions. The only html I want to allow is <a href> and <p>... but no images or scripts.

Sign in to reply to this post

Jason ByrnesWebAssist

the second argument of the strip_tags function allows you to specify allowed tags.

to allow <p> and <a href> tags, use:

php:
((isset($_POST["commentsbox"]))?(strip_tags($_POST["commentsbox"], '<p><a>')):"")
Sign in to reply to this post

ijk76319396

((isset($_POST["commentsbox"]))?(strip_tags ($_POST["commentsbox"]), '<p><a>'):"") gives me an error that says -Parse error: syntax error, unexpected ','

If I take out the ',' before the allowable tags it says -Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

Sign in to reply to this post

Jason ByrnesWebAssist

sorry, the code should be:

php:
((isset($_POST["commentsbox"]))?(strip_tags($_POST["commentsbox"], '<p><a>')):"")
Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...