i used a text field in an "add product form" to gether value for a database.

if the value i input is simple as this, mytest, then the database get the value right. and later on when i edit the record, i get this value from the database and set this value, mytest, as the value for the same text field but in the "edit product form".

all works fine.

but if the value i input is "mytest" instead mytest, with double quotes, then when add this value, it is fine. this value show up in my database as "mytest'. but when i edit this item, in the "eidt product form" this value, "mytest", is not shown up in the textfiled it is supposed to show.

but if i change the textfield to a textarea, then all works fine again. the "mytext" is shown up in that text box (now it is a text area instead of text field.)

i am using interbase as database, and php as language. here is a set up issue i think. help please!

    The problem is because the double quote is ending the input field. If you view source on the produced page you will see something like:

    <input type="text" name="whatever" value=""mytext"">

    notice the double quotes.

    The solution is to use htmlentities on the value when displaying it in the input field.

      Write a Reply...