Dato che non si capisce bene quello che vuoi fare sono andato un po' a spanne, ma provalo...
codice:<script type="text/javascript"> var input = document.getElementById('esercente').getElementsByTagName('input'); <?php $query = mysql_query("select * from esercenti where es_0 = '$esercente'"); $i = 0; while($row = mysql_fetch_row($query)) { $str = ''; foreach($row as $value){ $str .= $value.";"; ?> input[<?=$i?>].value = '<?php echo $value; ?>'; <? } $i++; } ?> </script>