Results 1 to 2 of 2

Thread: Passing PHP variables to AnyLink Menu v2.2

  1. #1
    Join Date
    Jan 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Passing PHP variables to AnyLink Menu v2.2

    1) Script Title: AnyLink Drop Down Menu 2.2

    2) Script URL (on DD): DD AnyLink Drop Down Menu 2.2 Using the Vertical Menu on EU click.

    3) Describe problem: I found this amazing menu, works perfect with what I'm trying to accomplish on my site. I'm doing a lot of heavy PHP & MySQL db work, pulling variables into each page... It's a very dynamic site... My problem is I have no clue how to pass a variable that I've pulled from MySQL Query to the actual menu.

    I tried adding
    HTML Code:
    var member = "<?=$member?>"
    within the script added in the heading, but that didn't work. Then as well in the menucontents.js file, for example:
    HTML Code:
    ["Profile", "profile.php?UID="+member]
    It actually halted the menu from working at all and just made the link, a straight link, instead of popping up the menu. It seems adding the variable in the head doesn't both the script, what's doing it is the '+member' within the menucontents.js file... I've done this before with JS files, I'm not quite sure why this isn't working properly.

    A lil more of a description of what I want to do:
    The coding is for a display box to display users who are currently logged into my website and each user will have an arrow next to their name, where a user should be able to click on it to get the pop up menu and choose an option, like go to $member's profile, view $member's photos, etc... Each link would be dynamic in the sense that it would pass a variable to the URL (example: profile.php?UID=$member).

    Please help! Any help is greatly appreciated!
    Last edited by lilbran; 01-27-2011 at 12:57 AM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code:
    var member = "<?php echo $member; ?>";
    That assumes the file where you're doing this has the appropriate header, the .php extension, and that $member is already defined.

    One tool you may or may not be aware of for diagnosing stuff like this is the browser's 'view source'. It will show you what the server is serving to the browser. So for example, if the above code is done properly, the 'view source' will look something like:

    Code:
    var member = "John Doe";
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •