html - Using sessions to preserve <td> values in PHP -


i have table generate columns using loop so:

echo <table> echo "<tr>"; for($i = 0; $i < $num_columns; $i++){    echo "<td>" . $resultarr[$i] . "</td>"; }    echo </tr> 

but when reload page, values in columns lost , keep them. i've used sessions before input boxes can specify input's name , value, how accomplish same thing tag?

you can quite save whole array inside session.

$_session['resultarr'] = $resultarr; 

then use later on in for loop this

for($i = 0; $i < $num_columns; $i++)     echo "<td>".$_session['resultarr'][$i]."</td>"; 

Comments