Results 1 to 6 of 6

Thread: Help..

  1. #1
    Cheeko
    Guest

    Red face Help..

    Ok, I'm doing a little page using java script and php. Anyway, Ive got a function that is run on the mousedown event of a button..

    What I want to know is how to assign a variable in java to a variable in php?

    eg:

    Code:
    function do_co()
    {
    x=document.form2.x.value
    y=document.form2.y.value
    z=document.form2.z.value
    <?
    $co = 'x';
    ?>
    thread_title.innerHTML="<? echo $co; ?>"
    }
    I want $co to equal the 'x' value in the java script..

    Any ideas?

  2. #2
    ricmitch_uk
    Guest
    I think you're going about it the wrong way. The scripts cannot be linked directly without asking the webserver for a new page. To do that you could use this code in your header
    Code:
    x=document.form2.x.value;
    document.location = 'mypage.php?co=' + x;
    or something like that.

    Be more specific, and maybe I could help more....

  3. #3
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609
    Originally posted by ricmitch_uk
    Be more specific, and maybe I could help more....
    transferring a variable value from JS to PHP, pretty simple to understand to me

  4. #4
    ricmitch_uk
    Guest
    Originally posted by ubunreal69
    transferring a variable value from JS to PHP, pretty simple to understand to me
    Any way is simple, it's just unclear how (s)he wants it done, there are a number of ways.

  5. #5
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609
    Originally posted by ricmitch_uk
    Any way is simple, it's just unclear how (s)he wants it done, there are a number of ways.
    fair enough, sorry

  6. #6
    ricmitch_uk
    Guest
    Don't be.

Posting Permissions

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



Click Here to Expand Forum to Full Width