Here is the code....
if(!(isset($_POST["email"]) && isset($_POST["sessionKey"]) && isset($_POST["page"]) && isset($_POST["ipp"]))){
return;
}else{
$email = htmlspecialchars($_POST["email"]);
$sessionKey = htmlspecialchars($_POST["sessionKey"]);
$page = htmlspecialchars($_POST["page"]);
$ipp = htmlspecialchars($_POST["ipp"]);
}
ok, the idea is I MUST assign the parameter with the same variables. For example, if I post a parameter "test" , I must assign this to a variable .... test... ...Is there any short cut for me to doing something like this? Thank you.
$data=array_map('htmlspecialchars',$_POST);
extract($data);
Be careful with extract this can override your existing variables with same name but you can change this behaviour by passing additional parameter to extract function.
Have a look at:
http://php.net/manual/en//function.extract.php
Also, isset
accepts more than one parameter, so you could use it like this:
if (isset($_POST["sessionKey"], $_POST["page"], $_POST["ipp"])) ...
See: http://www.php.net/manual/en/function.isset.php
Here's another possibility for the extraction part:
foreach (array('email','sessionKey','page','ipp') as $v) {
$$v = htmlspecialchars($_POST[$v]);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With