Prusprus
Prusprus

Reputation: 8065

isset won't identify parameters in url

I have the following code in my file.php file:

if (isset($_POST["activate"])){
    $confirmed = true;  
    $result = execute_query("UPDATE tributes SET t_confirm = 1 WHERE t_id=".$_POST["tid"]." AND t_activation='".$_POST["activate"]."'");
    if($result){

    }   
}else{
    print "NO"; 
}

I call this file throught he following url:

http://localhost/ccmta/tribute.php?tid=55&activate=QiScE8W76whfQD0Twd15enG31yDEf1iVGLL0SHEB9doqI16bd8kskOPXu6bGZE65o7XPp9EXUBCJS7IbcjNZ98hA8vR11b0Ve0Qm

but the isset function won't recognize the activate variable that's in parameter in the URL and falls into the else bracket. I've also called print_r to see what is in the $_POST variable and it's an empty array. Any idea why?

Upvotes: 0

Views: 188

Answers (1)

Ry-
Ry-

Reputation: 224942

Yes - $_POST is the array of POST, not GET (query string/URL) data. If you want both, use $_REQUEST, otherwise, use $_GET.

Upvotes: 5

Related Questions