Re: [PHP] Saving css state in javascript and passing to php via form submit
- From: jochem@xxxxxxxxxxxxx (Jochem Maas)
- Date: Fri, 30 Mar 2007 19:20:01 +0200
Tim wrote:
> > > > >
Ermmm...server-side session data? i never heard of server-side sessions...Hmm javascript setting server-side session data??only get theI think you want to use sessions for this :)Ok, i can put the data in the session variable, but i can
"current" state through javascriptblocks that
ie:onsubmit="getstate()"; which would get the id's of the
are set to display:block;session variable?
But in getstate() how do i pass that to php to set that
You could use AJAX to get things from/to PHP, but why should you?
You can use session within javascript too i believe.
Sounds weird, but i'll look into it..
AFAIK they are send in the HTTP headers from and to the server.
Cookies are nearly the same as sessions, i found this article (with
examples) that goes about parsing cookies from javascript. So
you could also do it with cookies.
http://www.javascriptkit.com/javatutors/cookie2.shtml
Isn't $_SESSION a superglobal available only during script execution?
Yes it sets a session_id in a cookie to which is sent to the server to
identifie the client, but to my knowledge $_SESSION['my_var'] = 'some_data';
is stored server side and set only through a server side script...
Now storing data in cookies is client-side, that i agree..
Am i confused or are you confusing me? :P
intergrate itNice tutorial thanks for that, i'll look it up, maybeyet, but yesTijnemaIn the next version of my framework i would like to, i still
ps. Maybe you could also use AJAX instead of submitting forms
the whole time.
havent quite understood the whole concept, not enough research
i'll be doing that next ;) (you know deadlines, can't sitand read docs all day etc..
Although i'd rather!)Really, it's not that hard to use AJAX. You might want to look at
;)
Regards,
Tim
www.tizag.com, there it is really easy explained.
It's nothing more then making new request to scripts inside
javascript.
right away, would really make my day if i could :))It's not too hard, but if you already did a lot of work on
Regards,
Tim
the form processing, you prefer not to write it all over
again i think ;)
Wrote a class to do the form validation, so i could always make a .php that
runs the form data through the validator and sends back the response.. In
xml i think it has to be?
the response doesn't have to be in any particular form ... ofcourse the X in AJAX
refers to XML but it's not obligatory .... in the end your just spitting out
a big long string and your clientside code can do with it whatever it wants.
personally I prefer JSON formatted data, for which there are even a couple of
functions available in newer versions of php (otherwise you can find code on the net
easily enough to handle JSON data creation/parsing):
http://php.net/json
.
Regards,
Tim
- Follow-Ups:
- References:
- Prev by Date: Re: [PHP] Saving css state in javascript and passing to php via form submit
- Next by Date: Re: [PHP] simple page not found 404 script - PHP
- Previous by thread: RE: [PHP] Saving css state in javascript and passing to php via form submit
- Next by thread: Re: [PHP] Saving css state in javascript and passing to php via form submit
- Index(es):
Relevant Pages
|