简体   繁体   中英

pass div class value to a variable in php

Here i want to pass div class value to the variable so far i had done like this. Here is my div <div class="modal_content_payment"></div> and here i have value getting 20 now i want to store that value in to a variable and use it in a PHP function.

my PHP code looks like this...

 <?php $p_amount=$this->db->get_where('tbl_abc',array('abc_id'=>`here i want that value`))->row();?>

i got value in div by using jquery see my code

<script>
function modal_payment(id,title)
{
  var measurement_id=id;
  $("#measmnt_id").val(measurement_id);
  var url='<?php echo base_url();?>admin_control/view_particular_amount_modal';

  $.post(url,{measurement_id:measurement_id}, function(result)
  {

     $(".modal_content_payment").html(result);
    jQuery('#modal_payment').modal('show', {backdrop: 'static',keyboard :false});

  });      
 }

</script>

first i want to store that div value in to a variable so i can use it in PHP please help me to solve.

You can get data through JavaScript.

Function printDiv(divName) {
     var printContents = document.getElementById(divName).innerHTML;
     var originalContents = document.body.innerHTML;

     document.body.innerHTML = printContents;

     document.body.innerHTML = originalContents;

}

Or you can use AJAX functionality.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM