html - PHP: How to save in session generated table, and apear everytime when curent user is login? -


this table, generated when user pick values in select boxes. how save in session generated table, , appear every time when current user login.

<table border="0" class="table table-hover table-striped" name="raspored" id="raspored" class="tablesorter">     <thead>         <tr colspan=2 bgcolor="#6d8fff">             <th>ИД</th>             <th>Предмет</th>             <th>Професор</th>             <th>Ден</th>             <th>Час</th>             <th>Просторија</th>             <th>Тип</th>         </tr>     </thead>     <?php     foreach ($_post['predmet'] $predmet) {         $_session['predmet'] = $_post['predmet'];         $rows = get_info($db, $predmet);         if (count($rows)){             foreach ($rows $row) {                        $_session['row'] = $rows;                 echo "<tr>" .                     "<td>" . $row["id"] . "</td>" .                     "<td>" . $row["predmet"] . "</td>" .                     "<td>" . $row["profesor"] . "</td>" .                     "<td>" . $row["den"] . "</td>" .                     "<td>" . $row["chas"] . "</td>" .                     "<td>" . $row["prostorija"] . "</td>" .                     "<td>" . $row["tip"] . "</td>" .                     "</tr>";             }         }        }     ?> </table> 

you can this. indenting didn't come through quite right, should still work.

<?php session_start(); //call if haven't done - you'll need call before html output page though unless have output buffering turned on such via http://php.net/manual/en/outcontrol.configuration.php#ini.output-buffering if ($_session['table_stored_in_session']) {     echo $_session['table_stored_in_session']; } else {         ob_start();     ?>     <table border="0" class="table table-hover table-striped" name="raspored" id="raspored" class="tablesorter">         <thead>             <tr colspan=2 bgcolor="#6d8fff">                 <th>??</th>                 <th>???????</th>                 <th>????????</th>                 <th>???</th>                 <th>???</th>                 <th>??????????</th>                 <th>???</th>             </tr>         </thead>         <?php         foreach ($_post['predmet'] $predmet) {             $_session['predmet'] = $_post['predmet'];             $rows = get_info($db, $predmet);             if (count($rows)){                 foreach ($rows $row) {                            $_session['row'] = $rows;                     echo "<tr>" .                         "<td>" . $row["id"] . "</td>" .                         "<td>" . $row["predmet"] . "</td>" .                         "<td>" . $row["profesor"] . "</td>" .                         "<td>" . $row["den"] . "</td>" .                         "<td>" . $row["chas"] . "</td>" .                         "<td>" . $row["prostorija"] . "</td>" .                         "<td>" . $row["tip"] . "</td>" .                         "</tr>";                 }             }            }         ?>     </table>     <?php     $table = ob_get_clean();     $_session['table_stored_in_session'] = $table;     echo $table; } ?> 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -