Is this hidden field called from ajax request? If so then try following:
$.post('php/get_flds.php', {postdbhost: dbhost, postdbuser: dbuser, postdbpass: dbpass, postselectdb: selectdb, postselecttbl: selecttbl},
function(d){
$('#display_out').html(d);
var num_flds = $('#num_fields').val();
alert('about to pop ' + num_flds);
for(var i = 0; i < num_flds; i++){
alert('populating ' + i);
pop_fld(i);
};
}
);
Otherwise the jquery doesn't know the value yet as this DOM is not in the document yet.