Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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