When I first started using php, I would manually create a variable from $_POST like so.
PHP Code:
$name = $_POST['name']; $email = $_POST['email'];
My lack of knowledge of php at the time cost me lots of time creating these variables. Sure, you could simply turn on register_globals, but that's a security thing.
Here is a way that you can simply create variable from post and also a simple function to sanitize them a bit.
PHP Code:
function sanitize($v) { return htmlentities(stripslashes(strip_tags($v))); }
foreach ($_POST as $n=$v) { ${$n} = sanitize($v); }
Now you'll have sanitized variables created.
|