javascript - How can I recall data from a previous session without cookies? -
i have page enter name , check series of checkboxes. result saved server-side text file using php.
i access data associated particular name using following php:
<?php $search = $_get["name"]; $comments = file_get_contents('comments.txt'); $array = explode("~",$comments); echo "<html>"; foreach($array $item){ if(strstr($item, $search)){ echo $item; } } ?>
i recall data @ future date. when select name again, associated checkboxes somehow change in css style (to remind me checked in previous session).
<nobr><input type="checkbox" name="comment" id="aaa" value="example text. " onclick="createorder()"><label for="aaa" onclick="createorder()" title= "example text."> example </label></nobr><br>
my theoretical solution: on press of button or such event, php search selected name, search aaa in association name, , (if found) change color of label aaa.
i'm not sure cookies appropriate here. simple php above echos data page. suggested method possible?
to elaborate:
goal enter name , check boxes. data stored in text file other names , checkbox data. perhaps such:
john smith aaa fff rrr jill jones bbb rrr zzz
on future session, when john smith entered again, labels checkboxes id aaa, fff, , rrr change color remind me checked last time.
the easiest way use php session variable store temporary data.
session_start();
$_session[$search] = $checkboxstates;
the session variable needs initialized , can used across multiple user requests. typically session relies on cookie data lost when browser clear cookie.
Comments
Post a Comment