Have you been searching for the slider script and implementing it in Ajax with PHP then you are in the right place buddy.Here is the post for you in which I’ve implemented javascript slider to work in Ajax using PHP. Ok let’s Begin it by creating the following tables in the database. Here is the mysql code to create the table named “tbl_slider” in database.
CREATE TABLE `tbl_slider` ( `id` smallint(6) NOT NULL auto_increment, `slider_val` smallint(6) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM;
And now, there is a file slider.js which contains the code of javascript for the slider. I’ve place the following code to call the Ajax function which is called when the slider is released after moving i.e on “onMouseUp” event,
setSliderVal(document.getElementById(‘slider1′).style.left);
Slider1 is the if Division(div) which is available in the index.php file. The following code displays the slider in the index.php file,
<div class="carpe_slider_group">
<div class="carpe_horizontal_slider_display_combo">
<div class="carpe_slider_display_holder">
<!-- Default value: 0 -->
<input name="Input" class="carpe_slider_display" id="display1" value="<?=$row['slider_val']?>" />
</div>
<div class="carpe_horizontal_slider_track">
<div class="carpe_slider_slit"></div>
<div class="carpe_slider" id="slider1" display="display1" style="left:<?=$row['slider_val']?>px"></div>
</div>
</div>
</div>
As you can see above there is “=$row['slider_val']?>” which is value of the slider stored in the database, the code for retrieving value from database look like this you can find this code in the index.php file.
<?php
$link = mysql_connect('localhost', 'root', ''); //change the configuration if required
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('db_slider'); //change the name of the database if equired
$query="SELECT slider_val FROM tbl_slider WHERE id='1'";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
And in the index.php there is Ajax function called "setSliderVal()" which is called from silder.js and use the ajax to call AJAX4Slider.php and retrive the current value of the slider from database.Here is the code of the AJAX4Slider.php.
$sliderval=$_GET['sliderval']; //get the value from ajax function
$link = mysql_connect('localhost', 'root', ''); //change the onfiguration in required
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('db_slider'); //change the name of the database if required
$query="UPDATE tbl_slider SET slider_val='$sliderval' WHERE id='1'";
$result=mysql_query($query);
?>
The above code saves the value of the slider to the database.

Gracias por compartir su maestría en esta área. Hay mucho Info inútil en esto que flota alrededor y aprecio su trabajo duro.
I just added this website to my bookmarks. I like reading your posts. Tyvm!
I enjoy the beneficial information you offer in your articles or blog posts. I will save your website and have my children check up here often. I am quite sure they will learn lots of new stuff here than anybody else!
This really answered my problem, thank you!
thanks amigo! great post!
Several of the factors associated with this blog post are generally advantageous nonetheless had me personally wanting to know, did they seriously imply that? One stage I’ve got to say is your writing expertise are excellent and I’ll be returning back again for any brand-new blog post you arrive up with, you might possibly possess a brand-new supporter. I book marked your weblog for reference.
You completed a number of fine points there. I did a search on the subject matter and found mainly persons will agree with your blog.
Nice tactics for publications and advertising the product to reach people and good way of conversation with the people.
I want some critical assist receiving facebook or twitter admirers :[
I must say, even though examining via dozens and dozens of weblogs weekly, the concept of your weblog is distinguishable (for the appropriate motives). Should you not head me personally inquiring, exactly what is the brand of this style or perhaps would it not certainly be a particularly designed extramarital relationship? It’s far far better in comparison to styles I take advantage of for a few regarding my personal sites ;–)
I couldn’t resist commenting.