title: PHP Set and Read a Cookie String
body: <p>I've got my form all completed, I know how to set a singular cookie using PHP however what is the best format to set a cookie string. I would like to have a cookie like so (or similar, my formatting is just an example);</p>
  
  <p>Prefs[theme=this&amp;layout=that]</p>
  
  <p>How would I set a cookie like so and then get the information from my string?</p>
  
  <h2>Code So Far:</h2>
  
  <pre><code>&lt;?php
      if (isset($_POST['submitted'])) {
          $a = gmdate("M d Y H:i:s");
          $b = "Cookies=true&amp;Cookies_Accepted=" . $a . "";
          $c = $_POST["APT_SELECTED"];
          $d = $_POST["APPT_SELECTED"];
          if ($d == 'Custom') {
              $d = $c;
          };
          $e = $_POST["APL_SELECTED"];
          $f = $_POST["APTNP_SELECTED"];
          $g = $_POST["APSNP_SELECTED"];
          $h = $_POST["APSNM_SELECTED"];
          $i = $_POST["ScreenTimeout"];
          $j = time() + (10 * 365 * 24 * 60 * 60);
          $k = "/admin/";
          $l = "rafflebananza.com";
          $m = array(
              'APCA' =&gt; 'true',
              'APCAW' =&gt; $a,
              'APT' =&gt; $c,
              'APPT' =&gt; $d,
              'APL' =&gt; $e,
              'APTNP' =&gt; $f,
              'APSNP' =&gt; $g,
              'APSNM' =&gt; $h,
              'APLSA' =&gt; $i
          );
          foreach ($m as $n =&gt; $o) {
              setcookie("RBAP_Prefs[$n]", $o, $j, $k, $l);
          };
          header("Location: http://admin.rafflebananza.com/incex.php");
      };
  ?&gt;
  </code></pre>