When you add <?php echo $name; ?> to your script in the middle of some html, it gets replaced by the actual value of $name before it arrives at the browser.
Is there some way of doing this substitution, and putting the results in a string (maybe to add keep for later)? I can't see any way to do this.