|
Posted by Tim Streater on 03/09/06 15:27
In article <20060309092050.09166c90.juanjo@iteisa.com>,
Juan Josι Gutiιrrez de Quevedo Pιrez <juanjo@iteisa.com> wrote:
> El 8 Mar 2006 22:44:54 -0800
> VHfc escribiσ:
>
> > Then I'm stuck, since I need the content of $txt back in my JS, either
> > in a global JS variable or as the value in a <textarea>, whatever.
> > I tried the cookie mechanism, writing $txt as an escaped string in a
> > cookie in the PHP snipplet, then reading that cookie back in JS and
> > unescape it. That worked fine, but...
>
> well, and why don't you just output inside a textarea?, something like
>
> echo "<textarea>$txt</textarea>";
>
> if you don't want to see it you can just hide it using css
>
> you can also use a hidden field for this:
>
> echo "<input type=\"hidden\" id=\"txt var\" value=\"$txt\"/>";
This is the sort of technique I use too, where I have to use PHP to get
data I need from a mysql database, but then manipulate it in JavaScript
before using PHP to write it back to mysql.
The values I get from mysql are written into a form with hidden
variables, and their values then picked up with an onload function to be
put into JS variables. The new values are then later loaded into hidden
form variables, and picked up by the next page as PHP values in order to
be written back to the database.
-- tim
[Back to original message]
|