oLraX oLraX - 6 months ago 11
PHP Question

Can't read space as default values in input text

I have some problem with entering default values in an input text form.
For example if the default value is "Hello World", the input field will only show "Hello."
It only accepts the first word. Is there something that I can do to accept the whole string?

<input type='text' name='prod_name' size='30' value=<?=$prname?> />


You need to put quotes around your value attribute

<input type='text' name='prod_name' size='30' value='<?=$prname?>' />

Notice, a $prname value of "Hello World" would yield this:

<input type='text' name='prod_name' size='30' value=Hello World> />

In which case the HTML thinks your input value is "Hello", and "World" is some non-existent boolean attribute.