[thelist] Saving a javascript variable for access from php function
Ann Adamcik
daadamcik at yahoo.com
Mon Sep 18 12:23:28 CDT 2006
The short question:
How can I save a javascript variable on a form page, and then access it from a php function after the form is submitted?
The longer version:
On a form page, amongst other things, I have some javascript that will wrap a span tag around the user's text selection like so:
Before - <p id="revessay">Here's an essay blah blah blah...</p>
After (the user selected the word essay) - <p id="revessay">Here's an <span class="comment">essay</span> blah blah blah...</p>
Before the form is submitted, I want to save the modified contents of revessay (to a cookie, session variable, or ?), so that my php form processing function can access it and insert it into the database.
I'm retrieving the html like so: var newhtml=document.getElementById("revessay").innerHTML, but I'm having trouble figuring out how/where to save it, and then how to access it from my php function.
Can anyone point me in the right direction here?
Thanks!
-Ann
More information about the thelist
mailing list