We help IT Professionals succeed at work.
Get Started

JQuery UI Slider in a html form

1,676 Views
Last Modified: 2012-05-09
Please Help

I have a form that will have several select elements to search a property database. I understand how to get the variables the user selects and pass them to the next php page where I use sql to search a mysql database.

However This jquery Ui Slider is confusing me. I need to know how I pass the min and max price selected to the next page so I can then use $_GET['minprice] and $_GET['maxprice'] with php and then query the database.

The slider looks great in the browser BUT in the coder i have posted here i can see how i get the two seperate vaules ??? I have searched the web and cant find a solution

Can some one please show me what i need to add to the code so when the form is submitted the variables are passed to the next page

thanks in advance
Barry
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

<link type="text/css" href="development-bundle/themes/base/jquery.ui.all.css" rel="stylesheet" />
	<script type="text/javascript" src="development-bundle/jquery-1.4.2.js"></script>
	<script type="text/javascript" src="development-bundle/ui/jquery.ui.core.js"></script>
	<script type="text/javascript" src="development-bundle/ui/jquery.ui.widget.js"></script>
	<script type="text/javascript" src="development-bundle/ui/jquery.ui.mouse.js"></script>
	<script type="text/javascript" src="development-bundle/ui/jquery.ui.slider.js"></script>

<style type="text/css">
		#demo-frame > div.demo { padding: 10px !important; };
	body {
}
</style>
	<script type="text/javascript">
	$(function() {
		$("#slider-range").slider({
			range: true,
			min: 0,
			max: 1000000,
			values: [0, 1000000],
			slide: function(event, ui) {
				$("#amount").val('£' + ui.values[0] + ' - £' + ui.values[1]);
			}
		});
		$("#amount").val('$' + $("#slider-range").slider("values", 0) + ' - $' + $("#slider-range").slider("values", 1));
	});
	</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">


</head>

<body>


<div class="range">

<label for="amount">Price range:</label>
<input name="amount" type="text" id="amount" style="border:0; color:#f6931f; font-weight:bold;" />


<label></label>
<div id="slider-range"></div>

</div>


</body>
</html>

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE