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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.