Handling quote characters in HTML form input fields

/ Published in: PHP
Save to your folder(s)

Copy this code and paste it in your HTML
  1. htmlentities($this->value, ENT_QUOTES)
  3. // The ENT_QUOTES parameter in the htmlentities() function ensures that single quote characters are encoded, since by default they are not (though double quote characters are). htmlentities() also encodes other characters and is useful for ensuring that characters such as "<" and "&" are not interpreted as HTML special characters.
  4. // source: http://www.primitivetype.com/articles/quotes_inputs.php

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.