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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:54:56+00:00 2026-06-04T19:54:56+00:00

I have a HTML form value as a PHP function: value=’.$item->get_title().’ (This is in

  • 0

I have a HTML form value as a PHP function: value='".$item->get_title()."' (This is in an echo statement hence the single quotes.) The problem is that if the returned title contains any quotes it breaks the value function.

Example: value="Kim Dotcom lawyer blasts US government" s "pattern of delay &quote;'>

As you can see it breaks at government. There is supposed to be an apostrophe after that.

Does anyone know a fix for this?

The fix: value='".htmlspecialchars($item->get_title(), ENT_QUOTES)."'

  • 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-04T19:54:57+00:00Added an answer on June 4, 2026 at 7:54 pm

    Use htmlspecialchars to escape output not meant to be rendered as HTML:

    value="'.htmlspecialchars($item->get_title(), ENT_QUOTES).'"
    

    By default, htmlspecialchars only escapes double quotes, not single quotes. If you want to escape both (and so maintain your practice of putting HTML values in single quotes), add ENT_QUOTES as the second parameter to htmlspecialchars.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this html form echo <form name='delete_article_form.$row['id'].' action='sources/public/article_processor.php' method='POST' >; echo <input name='processor_switcher'
I have following html form: <form method=post action=> <input type=hidden name=userid id=user value=<?php echo
I have HTML that looks like this: <form id=kinodForm> <input type=text name=element[5] value=krispy kreme
I am generating the following html form with this php: echo <form name=\userForm\> Username:
I have a HTML form that posts to PHP. I get a bunch of
i have an html form ,php scrip and jquery. i need a ajax code
I have these codes: testing.php <html> <head> <script type=text/javascript> function copy_data(id){ var a =
I have the following form in cakephp: <div class=quickcontactDisplay> <?php echo $form->create('Enquiry',array('action'=>'add','class'=>'quickcontact')); echo $form->hidden('visitor_id',
I have the following Javascript code: function checkIfValid(){ var form = document.createuserform; if(form.fName.value ==
I have a HTML form asking for user input. A javascript function is meant

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.