Is there a php function to convert text to decimal ncr?

by 5 replies
7
Is there a way to convert input texts to its decimal ncr in php?
I am currently using the form method (<form> & <input>) to send text information to a php file.

But I would like to send these texts converted to ncr decimal.
For example, when I type "abc" in text input, I want it to be sent to php as
& #97 ;&# 98;&# 99;.

The reason because post returns error when text contains quotas, question marks, smile faces ... etc.

Thanks
#programming #convert #decimal #function #ncr #php #text
  • Try not to convert it to decimal-code, lets try to fix the error
    What kind of error that you get?
  • No, you use php to convert the characters. HTML isn't programming, it's markup. (You could use Javascript, but why bother? It's trivial in php.
  • PHP: htmlentities - Manual will convert a string into a HTML-entity based string (i.e. with quotes as & quot; etc).

    This will then let you store the string into your database.
  • POST doesn't care what's in the string. The problem is whatever you do to process the data later.
    If you are inserting the data into a database, you should escape the string before trying to insert it.

    If you are programming in PHP:
    For MySQL use mysqli_real_escape_string (mysql_escape_string in PHP 4.X)
    Otherwise use addslashes

    For other languages, look up how to escape a string.
  • and since we don't have all the details of what you are trying to do to actually answer your question you need to look into iconv.

    East to change from one encoding to another encoding type with it.

Next Topics on Trending Feed