session - Methods on passing code from one php page to another -


i'm sorry if simple question, i'm new php!

anyhow, issue following: have few lines of code on 1 page, in use mysql, html , php, , pass onto php page. thinking @ first use $_session, while worked text/variables, didn't work more extensive code. i'm supposing it's not made that. other alternative had thought of use include/require functions, mean taking entire page of code, although need small portion of it. options?

for example, if had following:

<html> <table> <td><select name="example"> <?php while ($example_variable=mysqli_fetch_array($example_mysql_select)){ echo "<option>" . $example_variable['field'] . "</option>"; } ?> </html> 

... wouldn't work session. have alternatives, or stuck require/include? there ways of getting session it?

thanks lot in advance.

try serializing it:

$_session['var'] = serialize($var); 

then access with:

 $var = unserialize($_session['var']); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -