Question

Is there any way to do some kind of while() for each post variable and session it up... like in mysql

while($row=mysql_fetch_array($result)){
echo($row['name'];
}

But to get this result with the $_POST

while($_POST){
$_SESSION['BLA'] = $_POST['BLA'];
}
Was it helpful?

Solution

foreach($_POST as $key => $value){
echo $key . ' = ' .$value. ' <br />';
 // do whatever you want to do with these variables
}

Or

just for example, if you just want to put all of those in $_POST into $_SESSION

$_SESSION['MyPost'] = $_POST;

OTHER TIPS

foreach($_POST as $i=>$v){
    $_SESSION[$i] = $_POST[$i];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top