Ad

How To Get HTML5 Range Slider's Value In PHP?

- 1 answer

i have a HTML5 Range Slider. We can i send this value to php? I will send a Email with this value.

HTML:

 <div class="unit">
   <div class="slider-group">
        Max value:
   <label id="1-h"></label>
  </div>
  <div id="slider-1-h"></div>
</div>

Javascript:

$(function() {
    $( '#slider-1-h' ).slider({
        range: "min",
        min: 0,
        max: 300,
        value: 99,
        slide: function( event, ui ) {
            $( '#1-h' ).html( ui.value );
        }
    });
    $( '#1-h' ).html( $( '#slider-1-h' ).slider( 'value' ) );
});

Ok that is fine. And now, we can is send this? I have no input box. I can`t use $_POST[""] or?

:/

Ad

Answer

in the jquery add:

change: function(event, ui) {
      $('#sliderValue').attr('value', ui.value);
    }

in form add:

<input type="hidden" name="sliderValue" id="sliderValue" value="">
Ad
source: stackoverflow.com
Ad