nezbo Posted January 18, 2008 Share Posted January 18, 2008 hi all i have just started out using javascript and i am trying to updata a database using php and a javascript function. i am not to sure how to go about this for the best :: i have expanding menus and i want then to update a database when they are expanded. so that when the user is logged on, the menus are set to the way they like them. here is the site to give you an idea about the menus. wwwleastlancsmedicalservices.co.uk click on the home hedder and the menu will srink... Quote Link to comment https://forums.phpfreaks.com/topic/86643-php-and-javascrpit-adding-to-mysql/ Share on other sites More sharing options...
Daniel0 Posted January 18, 2008 Share Posted January 18, 2008 You could use AJAX, but I'd just set a cookie, it's much easier. Quote Link to comment https://forums.phpfreaks.com/topic/86643-php-and-javascrpit-adding-to-mysql/#findComment-442757 Share on other sites More sharing options...
nezbo Posted January 18, 2008 Author Share Posted January 18, 2008 i have tryed to set cookie's but i am not to sute how to set this up i have the 2 java script functions to getCookies and to pricess the expanding of them menus where should i add the set cookes and stuff also will it keep the setings when i go to another page on the site? Cheers <!-- Java script Functions --> <script language="javascript"> function GetCookie(sName) { var aCookie = document.cookie.split("; "); for (var i=0; i < aCookie.length; i++) { var aCrumb = aCookie[i].split("="); if (sName == aCrumb[0]) return unescape(aCrumb[1]); } return null; } function hide_linksy(lname) { var e = document.getElementById(lname).style; if(e.visibility == 'hidden') { e.visibility = 'visible'; e.position = 'relative'; } else { e.visibility = 'hidden'; e.position = 'absolute'; } } </script> You could use AJAX, but I'd just set a cookie, it's much easier. Quote Link to comment https://forums.phpfreaks.com/topic/86643-php-and-javascrpit-adding-to-mysql/#findComment-442761 Share on other sites More sharing options...
nezbo Posted January 19, 2008 Author Share Posted January 19, 2008 anybody any idea? Quote Link to comment https://forums.phpfreaks.com/topic/86643-php-and-javascrpit-adding-to-mysql/#findComment-443455 Share on other sites More sharing options...
tinker Posted January 19, 2008 Share Posted January 19, 2008 yes the cookie way sounds better than the way i've posted in the js forum... Quote Link to comment https://forums.phpfreaks.com/topic/86643-php-and-javascrpit-adding-to-mysql/#findComment-443460 Share on other sites More sharing options...
nezbo Posted January 19, 2008 Author Share Posted January 19, 2008 How would i do the cookies, i have tryed but i cant get it to work. can this code be modifide ? Quote Link to comment https://forums.phpfreaks.com/topic/86643-php-and-javascrpit-adding-to-mysql/#findComment-443554 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.