My form goes from 'html form' to 'javascript validation' which 'submits the form' which goes to 'PHP validation' which 'outputs the new data'. I want to use sessions to store the variable so PHP can get it when the page refreshes but I get an error when I place this code in my javascript just before the submit function. <?PHP include("session.php"); ?> //this is session.php <?PHP echo session_start(); echo $_SESSION['varusername'] = $lusername; echo $_SESSION['varmemberalready'] = 1; ?> Why won't it work and how can I make it work? I was thinking about using $_post with hidden forms, would that work? Thanks. ~imozeb
But you can do it the other way. Example: <?PHP echo session_start(); ?> <script type="text/javascript"> var lusername = <? echo $_SESSION['varusername'] ?> </script> Code (markup): This will assign the varusernameto the lusername. Hope this helps.
I want to assign varusername to lusername not the other way around. Is there anyway I can do this? Do you think hidden forms will work so that the javascript changes the value of the hidden form, then the form is submited, and PHP gets the value via $_POST ?