-3

i will get two jquery value in jquery variable how i will convert value in php variable

 <script>
    $(document).ready(function()
    {
        $(".slv").change(function()
            {
            var proid = $(this).attr('id');
            var proval = $(this).val();
            <?php $id1=?>proid;
          <?php $id2=?>proval;
        <?php
              $data = array('name' => $id1,
                'value'=>$id2, 
                'expire'=>'86500');

        $this->input->set_cookie($data);
        ?>

            });

    });

Jadav Ramesh
  • 11
  • 1
  • 7
  • hello pleace help me – Jadav Ramesh Jan 19 '18 at 17:06
  • client-side script !== server-side script .... you can't just go from jquery/js to php like that... you need ajax or something like it. – Alex Jan 19 '18 at 20:07
  • 1
    Possible duplicate of [What is the difference between client-side and server-side programming?](https://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming) – Alex Jan 19 '18 at 20:07

2 Answers2

0

Try set value into a cookie.

Here you will see how you can do it

how to assign javascript variable value to php variable

Alejandro V.
  • 26
  • 1
  • 8
0

Use Ajax to post these values

$.ajax({ type: "POST", url: "http://localhost/test/testcontroller/testfunction", data: {'proid':proid,'proval':proval}, success: function(data) { },

    }

});

And in controller you can get it like

$this->input->post('proid'); $this->input->post('proval');

AjithChadda
  • 51
  • 3
  • 18