Jump to content

php and javascrpit adding to mysql


nezbo

Recommended Posts

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...

 

 

Link to comment
https://forums.phpfreaks.com/topic/86643-php-and-javascrpit-adding-to-mysql/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.