#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Posts
    40
    Rep Power
    14

    Retrieving javascript variables and passing them to PHP.


    Problem:

    I'm writing an application that makes use of contenteditable="true" attributes in <div> and <span> tags.
    I am able to retrieve the values of these editable elements using some simple dhtml.

    What I wish to do, is take the values returned from the editable elements and pass them to a PHP class I'm writing.

    Can anyone give me an example of how this might be done?

    Yours,
    estron
  2. #2
  3. No Profile Picture
    aHVoPw==
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2001
    Posts
    1,058
    Rep Power
    15
    The only few ways php can get data from a webpage is though a form, url, or cookies. I'm assuming you have the values stored in javascript variables already. Then just have javascript load the php page:
    PHP Code:
    <script>
    document.location() = "http://blah.com/page.php?phpvar1=" jsvar1 "&phpvar2=" jsvar2;
    </script> 
    something like that.
    Visit my new IIS Tutorial Series!

IMN logo majestic logo threadwatch logo seochat tools logo