title: using session_start with header redirect
body: <p>User fills out a form on page 1. The form submits to page 2 with POST. page 2 makes the database insert but needs to insert the user id that is stored in a session variable so I need to do a session start that to get that session variable but that prevents me from using a header redirect at the end to stop re-submissions. I don't want to set the user id to a hidden input on page 1 because that would be fairly easy to spoof. I'm obviously doing something not in accord with best practices, what should I be doing?</p>
  
  <pre><code>    &lt;?php
  @session_start();
  require_once '../Classes/Communication.php';
  require_once '../Classes/Communication_db.php';
  $noteDate=$_POST["noteDate"];
  $noteContact = $_POST["noteContact"];
  $note= $_POST["note"];
  $custID = $_POST["custID"];
  
  $comm = new Communication();
  $comm-&gt;setCustomerID($custID);
  $comm-&gt;setCommunicationDate(date("Y-m-d", strtotime($noteDate)));
  $comm-&gt;setCustomerContactID($noteContact);
  $comm-&gt;setNotes($note);
  $comm-&gt;setUserID($_SESSION["userID"]);
  
  Communication_db::saveCommunication($comm);
  
  header("Location: ./index.php?action=newCustomer",303);
  
  ?&gt;
  </code></pre>