发送到隐藏的输入值另一个可见的文本输入在php中以相同的形式输入[关闭]

Is there a simple way to send to a hidden input value the value from another visible text input value in one single form? The action on my click would use different references names depending on the source of action. See my example:

<form id="floatleft" method="post">
    <label for="name">My Name:</label> 
    <input name="senderName" type="text" value="">
    <input name="first_name" type="hidden" value="">
    <input alt="P" name="submit" type="image" src="https://p.gif" value="P" onclick="this.form.action='https://p.html'" />
    <input alt="z" name="submit" type="image" src="https://www.z.png" value="z" onclick="this.form.action='https://www.z.com/';" />

Yeah you can do it with jQuery change function or keyup function

HTML

<input type="text" name="senderName" id="senderName" value="" />
<input type="hidden" name="first_name" id="first_name" value="" />

JS (Change function)

The change event occurs when the value of an element has been changed, so with change function, once the value inside senderName input changed its value (or updated value) copied to the first_name input. More Detail Here

$(document).ready(function(){
    $('#senderName').change(function() {
        $('#first_name').val($('#senderName').val());
    });
});

Fiddle with Change Function

JS (Keyup function)

With keyup function, once stop typing the value of senderName input will be copied to the first_name input. More Detail Here

$(document).ready(function(){
    $('#senderName').keyup(function(){
        $('#first_name').val($('#senderName').val());
    });
});

Fiddle with keyup function

$(document).ready(function(){

$( "#name").on('change',function() {
 
  $("#hiddenName").val($( "#name").val());
});

});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<form name="form" type="post">
<input type="text" name="name" id="name">
<input type="hidden" name="hiddeName" id="hiddenName" value="">
  <input type="submit" name="submit">
  </form>

</div>