如何将Jquery UI Slider的最终值提取到PHP变量中?

I want to display 2 JQ UI Sliders on 1 page. My Site is in PHP. I want to take final values from both sliders (last value when user will stop sliding them) into php variables and multiply them. How can I do this ?

I have exposure to Jquery and PHP. So it will be great if you could explain in detail.

This is a site to slider's jquery : http://jqueryui.com/slider/.Try out different sliders and have a look at there codes.Hopefully you will find something of your help.I know its not the best answer you would be expecting but every little help counts when in need.

PHP is used to render the page, once the page is rendered php can no longer interact with it. Using jquery you can make an ajax post back to your site with the 2 values something like:

var slider1FinalValue = false;
var slider2FinalValue = false;

$( "#slider1" ).slider({
  stop: function( event, ui ) {
    slider1FinalValue = $(this).slider( "value" );
    sendBothValuesIfSet();
  }
});
$( "#slider2" ).slider({
  stop: function( event, ui ) {
    slider1FinalValue = $(this).slider( "value" );
    sendBothValuesIfSet();
  }
});
function sendBothValuesIfSet(){
  if(slider1FinalValue !==false && slider2FinalValue !==false){
    $.post(
        'www.mydomain.com/myscript.php',
        {slider1:slider1FinalValue, slider2:slider2FinalValue }
    );
  }
}

Then in your php file:

<?php
if($_POST && !empty($_POST)){
  $sliders = json_decode($_POST);
  $multipliedValue = $sliders['slider1'] * $sliders['slider2'];
}

Something along those lines. I havent tested this code just wrote it on the fly so if you have issues let me know and ill adjust it as needed.

You could use ajax to pass the slider values to the PHP script.

Say you store the slider values as below:

$value = $("#slider").slider("value"); //or however you get the value

Then you can perform a post call like this:

$.post("test.php", { $slider_value: $value } );