为什么字符不能输入这个html输入字段?

There is a html input field text having a value from database , the value is : <input type=radio id="%id%" name="%name%" value="%valeur%" %checked% onclick="" />. In fact the data of the field is obtained using the htmlentities function in PHP on the returned column value from database.

The problem is that I cannot type any characters in the field , although the field is not read-only ! But I can delete characters in it using the back keybord or the delete keyboard.

So how can it be writable ?

its a radio button. make type=text

If your text field's value is <input type=radio id="%id%" name="%name%" value="%valeur%" %checked% onclick="" /> <, > are not valiud in text boxes value use &lt;, &gt; etc..

Use htmlspecialchars before putting things in value.

You cant use radio button to write text into it. Use type="text" or <textarea>

Use <input type="text" id="%id%" name="%name%" value="%valeur%" /> instead

edit after my initial post:

You need to escape the double quotes from the database using &quot;.

So this should works:

<input type="text" value="<input type=radio id=&quot;%id%&quot; name=&quot;%name%&quot; value=&quot;%valeur%&quot; %checked% onclick=&quot;&quot;/>" />

So, you need to escape before the database insertion or when you put the value in your text field. But in both case, double quote need to be changed.

Use php htmlspecialchars() for this.

Look this Fiddle.