When I use PHP to set the value of a HTML form input element, it works fine provided I don\'t have any spaces in the data.
/>
You have to wrap the variable result with quotes, so that the browser can know what's the content of the input.