You need to set the value attribute of the input MDN Input Reference
<input id="code" name="code" type="hidden" value="<?php echo $row['CodeFromDB']; ?>"/>
Also, verify that $row['CodeFromDB'] is not empty, either by echoing it, or using testing with php's empty() function.