/    Sign up×
Community /Pin to ProfileBookmark

Datepicker help needed

I dont know where to put this so im sorry if its in the wrong place to start!

I have a date picker that inserts into a datebase a number of days in one column so for example:

datearriving would have: 11-8-2012, 12-08-2012, 12-8-2012

What im struggling with is calling the values from the database to grey out the days in my form. Any ideas???

PHP Code:

[code=php]

var disabledDays = [

<?php while ($row = mysql_fetch_array($grey, MYSQL_ASSOC)) {
echo ‘”‘ . $row[‘datearriving’] . ‘”,’;
}
?>
];

/* utility functions */
function nationalLeavingDays(date) {
var m = date.getMonth(), d = date.getDate(), y = date.getFullYear();
for (i = 0; i < disabledDays.length; i++) {
if($.inArray((m+1) + ‘-‘ + d + ‘-‘ + y,disabledDays) != -1 || new Date() > date) {
return [false];
}
}
return [true];
}
function noWeekendsOrLeavingHolidays(date) {

return nationalLeavingDays(date);
}

/* create datepicker */
jQuery(document).ready(function() {

function displayVals() {
var numdays = $(“#num_days”).val();
jQuery(‘#datepicker’).multiDatesPicker({
mode: ‘daysRange’,
autoselectRange: [0,numdays]

});

}
$(“#num_days”).change(displayVals);
displayVals();
});
[/code]

Any help would be golden!

thanks!

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @swl7 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...