Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8927879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:18:37+00:00 2026-06-15T08:18:37+00:00

Using the php strip_tag function to prevent HTML injection into my database I was

  • 0

Using the php strip_tag function to prevent HTML injection into my database I was wondering if there’s any way I can detect if it’s been used, ie the following:

if (strip_tags has been used/had any effect on the code) { error; }

I want to output an error the user letting them know that HTML tags cannot be used before hand instead of going straight to the db insertion.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:18:38+00:00Added an answer on June 15, 2026 at 8:18 am

    Simply compare the sanitized data to the original data, and add a warning to the user if they don’t match:

    $data = $_GET["field_name"];
    $sanitized = strip_tags($data);
    if ($sanitized != $data) {
        echo "HTML not allowed.";
        // or...
        // throw new Exception("HTML not allowed.");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that using PHP's basename() function you can strip a known file extension
Is there a way I can strip out the variables from a link using
Is there any equivalents to PHP functions strip_tags and html_entity_decode? I'm using .NET 3.5
I was using the php strip_tags() function to remove html tags from my text
I'm using a PHP script to parse a HTML table into an array. But
I am using php to output some rich text. How can I strip out
I need to strip any non-alphanumeric characters from the end of strings using PHP's
Using PHP, I can convert MySQL data or static table data to csv, Excel,
I am using php to pull information out of a database, but I have
using jQuery tubeplayer , how can I set a single button that stop any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.