php - in a hidden input, how to get the input text value in another input? -


i'm using php. there're 2 inputs, aa , bb. aa text input users can input something, , want bb (which hidden input) submitted input value aa. tried this, however, seems aa_value null in input bb when submitting form. how implement that?

aa_value() {                  $value = '';                 if ( isset( $_post['aa'] ) )                         $value = $_post['aa'];                 echo $value;  }  <input type="text" name="aa" id="aa" value="<?php aa_value(); ?>  <input type="hidden" name="bb" id="bb" value="<?php aa_value(); ?> 

php server side language execute before render html on browser. need use javascript or jquery solve problem. use below code on blur or change.

<input type="text" name="aa" id="aa" value="<?php aa_value(); ?>  <input type="hidden" name="bb" id="bb" value="<?php aa_value(); ?>  <script> $(document).ready(function() { $('#aa').blur(function() { $('#bb').val($('#aa').val()); });  }); </script> 

after submition form able aa , bb values.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -