Take the 2-minute tour ×

Currently i want to print out full text from my database, but it just print out 1 text, i don't know why and how to solve it, the code and image showed below::

print "<td><input name='taskname[]' type='text' size='225' value=".$db_field['task_name']." readonly=readonly></td>";

enter image description here

suppose it come out full text like "configure new problem" but it didn't, why would it happen?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

You need to place the value of the value attribute between quotes:

       ^                          ^

And since you are outputting content inside HTML, you also need to call htmlspecialchars on it:

 value='".htmlspecialchars($db_field['task_name'], ENT_QUOTES)."'

The second (encoding options) and third (text encoding of input) parameters of htmlspecialchars must be set to correct values; please take a look at the documentation determine which ones are correct for you.

share|improve this answer
ya your are right, i also figured out should put ''between the value, thanks man –  newbie Sep 24 '12 at 8:17

Your Answer


