Organizational Research By

Surprising Reserch Topic

php is there a safe way to extract post using -'php'


php is there a safe way to extract post  using -'php'

Is there a safe way to auto assign the keys in a posted array? Below are two examples of wrong ways...

foreach( $_POST as $key => $value ) {
     $$key = $value;
}


or

extract($_POST)


Is there a better way, or is it best to code:

$foo = $_POST('foo');
$bar = $_POST('bar');
....


for all 50 inputs on my form?

(the posted info will be inserted into a database).
    

asked Sep 7, 2015 by rajesh
0 votes
6 views



Related Hot Questions

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

...