Replace $_GET with $_POST , and you are there. Basically, POST and GET are two different ways of passing variables into a script. The get method in php can also be attached at the end of the URL: script.php?variable=value , and it's really easy to crack. While the post method can be sent using forms or ajax calls, and it is pretty safe, at least more than get. I also suggest that you check to see if any GET or POST variable is set before calling it so that you can prevent stupid notification errors.
Just use the following code:
if (isset($_POST['var']) and !empty($_POST['var'])) {
You can also delete
}else{ // do nothing }
part of the script, since the else condition is optional.
source share