Passing the Value Button when click.
I know some of you this problem is pretty simple to do, but I am working in a week to find it out what is the right way to function it well.
in the 1stpage.php there is a multiple buttons with different values in it, ie:
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"> </script>
- <a href="#myModal" data-toggle="modal" value="#01" name="btn" class="button2 btn btn-primary model_open" data-btnval = "#01" aria-hidden="true" data-dismiss="modal" >form</a>
when clicking the button it will open the Modal Form inside the 1stpage.php and get the current Value button by using this script;
- <script>
- $(document).on("click", ".model_open", function () {
- var btnval = $(this).data('btnval');
- $(".modal-body #btnval").text( btnval );
- $('#hiddenid').val(btnval );
- });
- </script>
inside the Modal Form the Current Button is echoed, by using this php code;
- <?php
- $divName="btnval";
- echo "<div id=$divName></div>"; <!-- echoing the button value -->
- ?>
QUESTION: How could I pass the Current Value Button on the 2ndpage.php? does it need a jquery? or just a normal get code -->
value='
<?
php echo
$_GET
[
"btnval"
];
?>
' />
But I always got an error for this code, how could I put a name inside the 'div id' to get and echoing it to 2ndpage.php? please have time to see this -->
Full Code