Hmm, that really should work. The result should NOT be lost after closing the php block (as it's not scoped locally, like w/in a function). But you could make sure w/:
<input type="text" value="<?php echo $result[0]->name; ?>"/> <?php echo $result[0]->name; ?>
Could any CSS or JS be removing the input value (doubt it, since you said the above is the entire code of the PHP file. It is a theme template file we're talking about, right? Ie, not the content field of a "WP post (page)" -- as, by default, no PHP in content will run.)