That value is not inside the <input> tag:
<input name="firstname" type="text" id="firstname"<?php if(isset($_POST["firstname"])) { print " value=\"$_POST[firstname]\""; }?>>
But the easier way is this(you dont have to check that the $POST['firstname'] is set. If its not set it prints nothing):
<input name="firstname" type="text" id="firstname" value="<?=$_POST['firstname']?>">