title: unable to set cookie on form submission
body: <p>I'm trying to set a cookie on form submission and the form submission handler is running, as I connect to a db inside and that works, but the cookie is not being set.</p>
  
  <p>I've even tried to set a dummy cookie of just a string instead of one of the form values. What am I doing wrong?</p>
  
  <pre><code>&lt;?php
      if($_POST['submit'] &amp;&amp; $_POST['rememberMe']){
  
          //connect to db
          $idNumber=mysql_query("SELECT COUNT(id) FROM users");
          if(!$idNumber){ die('Count not get user id: '.mysql_error()); }
  
          setcookie('dummy', 'dummyCookie', time() + 60 * 60 * 24 * 90 );
          setcookie('id', $idNumber, time() + 60 * 60 * 24 * 90 );
          setcookie('name', $_POST['name'], time() + 60 * 60 * 24 * 90 );
  
          $sqlName = mysql_query("INSERT INTO users SET " .
          "name='".$_POST['name']);
          $sqlTeam = mysql_query("INSERT INTO users SET " .
          "team='".$_POST['faveTeam']);
          if(!$sqlName || !$sqlTeam){ die('Count not insert in database: '.mysql_error()); }
      }
  ?&gt;
  </code></pre>
  
  <p>Does anyone have any ideas?</p>