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 6887839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:56:01+00:00 2026-05-27T05:56:01+00:00

I have some text that I get from the database like this: $solution =

  • 0

I have some text that I get from the database like this:

$solution = $row['solution'];

Then I have some HTML I create in PHP using that variable like this:

echo '<a class="delete_suggested_solution" data-problem_id="'.$problem_id.'" data-suggested_solution_id="'.$suggested_solution_id.'" href="#">Delete</a> | <a href="#" class="edit_suggested_solution" data-problem_id="'.$problem_id.'" data-suggested_solution_id="'.$suggested_solution_id.'" data-solution_text="'.$solution.'" data-solution_title="'.$solution_name.'">Edit</a>';

That actually works fine in most cases, but when the $solution has a link in it like this <a href="http://SomeUrlWhatever.com">something</a> then this HTML breaks the HTML on the page when it is displayed.

Is there something that can be done so that the HTML on the page does not become broken for me?

Thanks!!

  • 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-05-27T05:56:02+00:00Added an answer on May 27, 2026 at 5:56 am

    Assuming the part you want here is something and not the link, just use strip_tags() and htmlentities() to retrieve only the tag’s inner text content, and encode quotes to be used inside HTML attributes.

    $solution = htmlentities(strip_tags($row['solution']), ENT_QUOTES);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some text that is stored in a variable like this: <div class=foo>text
Hey, I have some text that is formatted like this: [quote]foo text[/quote] and I
In my application I have a sqlite database that looks like this: CREATE TABLE
I have some text that uses Unicode punctuation, like left double quote, right single
I have some text that has HTML hyper-links in it. I want to remove
I have some text in a UITextView, that I would like to have show
i have some functionality i'd like to get from the server-side code into the
I have some html content stored in a database field. I would like trusted
I have a SELECT statement that looks like this: SELECT * FROM photos, p_votes
So I have some data that's coming back from a database query, and the

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.