More cookie problems, php
I'm sorry to keep asking stupid questions, but I have tried to research this and couldn't find it.

This time, I want to be able to check a _POST against an array, before deciding it's ok to set the cookie. Here's my snippet.   


    
   

    <?php
    header( 'Location: http://www.site.com/ler.php' ) ;
    ?>
    <?php
    setcookie("choice1","true",time()+20);
    ?>
    
    
    <?php
    
    $match_id = strtoupper($_POST["arr"]);
    
    
    //var_dump(implode($_POST));
    
    
    $bArray = array(
    "A"=>"1",
    "B"=>"2",
    "C"=>"3",
    "D"=>"4",
    "ETC"=>"5");



I need the array and variable to be set before the cookie, because I want to use array_key_exists conditional. I tried switching the order but that didn't do anything. I know it's not the header because the other code with cookies and headers works fine.  Any ideas??
More cookie problems, php
===

I'm sorry to keep asking stupid questions, but I have tried to research this and couldn't find it.

This time, I want to be able to check a _POST against an array, before deciding it's ok to set the cookie. Here's my snippet.   


    
   

    <?php
    header( 'Location: http://www.site.com/ler.php' ) ;
    ?>
    <?php
    setcookie("choice1","true",time()+20);
    ?>
    
    
    <?php
    
    $match_id = strtoupper($_POST["arr"]);
    
    
    //var_dump(implode($_POST));
    
    
    $bArray = array(
    "A"=>"1",
    "B"=>"2",
    "C"=>"3",
    "D"=>"4",
    "ETC"=>"5");



I need the array and variable to be set before the cookie, because I want to use array_key_exists conditional. I tried switching the order but that didn't do anything. I know it's not the header because the other code with cookies and headers works fine.  Any ideas??