View Single Post
Old 10-02-2012, 08:23 PM   PM User | #4
Cyberpops
New to the CF scene

 
Join Date: Oct 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Cyberpops is an unknown quantity at this point
Putting in whole code of the test page so far. slider does slide, the slider value is being processed to conPrice, but calculation does not work...

Code:
<script src="jquery.js" type="text/javascript" charset="utf-8"></script>
<!-- For slider -->
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>

<!-- Slider JS -->
<?php
$x = mysql_query("SELECT p_max AS max FROM dsd_price");
$y = mysql_query("SELECT p_min AS min FROM dsd_price");
$z = mysql_query("SELECT p_price AS price FROM dsd_price");
while ($x_array = mysql_fetch_array($x)){$max[] = $x_array['max'];}
while ($y_array = mysql_fetch_array($y)){$min[] = $y_array['min'];}
while ($z_array = mysql_fetch_array($z)){$price[] = $z_array['price'];}
?>
<script>
$(document).ready(function slider() {
$( "#slider" ).slider({
    value:1,
    min: 0,
    max: 201,
    step: 1,
    slide: function( event, ui ) {
  //Its setting the slider value to the element with id "conPrice" 
  $("#conPrice" ).val(ui.value);
    }
 });
    function price(){
    var frm = document.dsd_form;
    var quant = frm.conPrice;
    var overp = ['<?php echo implode("','", $price); ?>'];
    var mini = ['<?php echo implode("','", $min); ?>'];
    var maxi = ['<?php echo implode("','", $max); ?>'];
    for(var index = 0; quant > mini[index], quant < maxi[index]; index++){
        $( "#OverP" ).val( overp[index] );
    }
}
});
</script>
</head>
<body>
<form id="dsd_form" name="dsd_form" action="db_create_sql.php" method="post" class="niceform">
<fieldset>
       <dl>
            <dt><label for="conPrice">Price:</label></dt>
            <dd><input type="text" name="conPrice" id="conPrice" size="16" maxlength="128" />
            <input type="text" name="OverP" id="OverP" size="16" maxlength="128" />
            <div id="slider" ></div>
            </dd>
        </dl>
</fieldset>
</form>
</body>
</html>
Having SQL database:

Code:
 p_id | p_min | p_max | p_price
  1        1      1       11
  2        2      5       13
Cyberpops is offline   Reply With Quote