Jump to content

$HTTP_SESSION_VARS=$HTTP_POST_VARS; --- Possible?


Perfidus

Recommended Posts

I would like to store the values from a form inside the session vars without extracting every single one, just want to put the array inside the session array. I'm afraid I'm a little obfuscated at the moment to clear out if this syntax is any good...

Any tips? Should I make a loop to place them with index numbers? What should I do?

Link to comment
https://forums.phpfreaks.com/topic/87204-http_session_varshttp_post_vars-possible/
Share on other sites

You shouldn't use the long array names "HTTP_*", since those are going away. Use $_POST, $_SESSION, etc. You can do something like:

<?php
$_SESSION['POST'] = $_POST;
?>

That would put the $_POST array into the session variable POST.

 

You can also do:

<?php
foreach ($_POST as $key => $val)
    $_SESSION[$key] = $val;
?>

 

To aschk: No, there is no injection going on here. The OP probably just wants to store the information coming from a POSTed form.

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.