<input type="text" name="<?= e($x) ?>" class="d-none" aria-label="field1" value="ok">
<input type="text" name="<?= e($y) ?>" class="d-none" aria-label="field2" value="<?= e($z) ?>">

<script>
    document.getElementsByName(<?= json_encode($x) ?>)[0].value = document.getElementsByName(<?= json_encode($y) ?>)[0].value;
</script>
