problem is here
<input type=text name='name' value = <?echo $name?>></td>
there is no quote around the value so if it has multiple words it ends up like this
<input type=text name='name' value = this is a string></td>
the browser will see value = this, and since its not enclosed in quotes, it treats is a string as separate attributes of the tag.
simply use
<input type=text name='name' value='<?php echo $name?>'>