You missed the closing tag for input fields, and you can select any of the events, for example: onload, onclick, etc.
(a) Onload event:
<script type="text/javascript"> $(document).ready(function(){ $('#frm1').submit(); }); </script>
(b) Onclick Event:
<form name="frm1" id="frm1" action="../somePage" method="post"> Please Waite... <input type="hidden" name="uname" id="uname" value=<?php echo $uname;?> /> <input type="hidden" name="price" id="price" value=<?php echo $price;?> /> <input type="text" name="submit" id="submit" value="submit"> </form> <script type="text/javascript"> $('#submit').click(function(){ $('#frm1').submit(); }); </script>
source share