How to equate a php variable with a javascript var

Discussion in 'PHP' started by promotingspace.net, May 15, 2011.

  1. #1
    Hi
    I have some js code in my .php file
    In the js code I have a variable "names"
    I need to tell php the value of this variable and call it $names
    How can I do that?
    Thank you for your help
     
    promotingspace.net, May 15, 2011 IP
  2. Jane Management

    Jane Management Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Have you ever heard of AJAX ? :rolleyes:
     
    Jane Management, May 15, 2011 IP
  3. Projekt.Gopher

    Projekt.Gopher Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Does the PHP script only need to know the value of this variable once the page is submitted? Because if that's the case, you can stick the updates value of names into a hidden input field, and use an onPageUnload() function to send the value to the php script through a post submission.
     
    Projekt.Gopher, May 15, 2011 IP