sopranolv Posted September 21, 2015 Share Posted September 21, 2015 (edited) this working to select range and import in db and problem is that the don't show in slider range from mysql db need this <?=$user['sage']?> and <?=$user['sageto']?> to show here values: [ 2, 4 ], js $(function() { $( "#slider-range" ).slider({ range: true, min: 1, max: 100, values: [ 2, 4 ], slide: function( event, ui ) { $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] ); $( "input#bed_min").val(ui.values[ 0 ]); $( "input#bed_max").val(ui.values[ 1 ]); } }); $( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) + " - $" + $( "#slider-range" ).slider( "values", 1 ) ); }); php <p> <label for="amount">Price range:</label> <input type="text" id="amount" style="border: 0; color: #f6931f; font-weight: bold;" /> </p> <div style="width:400px;" id="slider-range"></div> min: <input id="bed_min" type="text" value="<?=$user['sage']?>" name="sage"><br> max: <input id="bed_max" type="text" value="<?=$user['sageto']?>" name="sageto"> Edited September 21, 2015 by sopranolv Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted September 21, 2015 Share Posted September 21, 2015 If the javascript is in the same file as your php code then replace the 2 and the 4 with your PHP variables values: [ <?=intval($user['sage'])?>, <?=intval($user['sageto'])?> ], Otherwise get the values from the two text fields values: [ parseInt($( "input#bed_min").val()), parseInt($( "input#bed_max").val()) ], 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.