title: PDO insert error php
body: <p>I'm trying to use the following script to inset values taken from a hidden form in to the database</p>
  
  <pre><code> /detect user session
   if (!isset($_SESSION['user']))
   {
  //if no session take to login page
  header('location:login_main.php');
   }
  
   //if session detected connect to database using pdo
   $db = getConnection();
  
   //get holiday infor from hidden form
  $user = $_SESSION['user'];
  $title = $_POST['title'];
  $link = $_POST['link'];
  $date = $_POST['date'];
  $description = $_POST['description'];
  
   //insert the values in to favorties table
   $sql = "INSERT INTO saved_holidays (subscriberID, link, pubDate, title, description, dateSaved) 
  VALUES (:subscriberID, :link, :pubDate, :title, :description, now())";
  
  $stmt = $db-&gt;prepare($sql);
  $stmt-&gt;bindParam(':subscriberID', $user);
  $stmt-&gt;bindParam(':link', $link);
  $stmt-&gt;bindParam(':pubDate',$date);
  $stmt-&gt;bindParam(':title', $title);
  $stmt-&gt;bindParam(':description', $description);
  $stmt-&gt;execute();
  
  echo 'you have sucessfully saved the holiday offer.&lt;meta http-equiv="refresh" content="2; url=index.php" /&gt;';
  </code></pre>
  
  <p>however when i run the script i get the following error</p>
  
  <pre><code>Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity     constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails     (`unn_w11023553/saved_holidays`, CONSTRAINT `holidays_ibfk_1` FOREIGN KEY (`subscriberID`)     REFERENCES `subscriber` (`email`) ON UPDATE CASCADE)' in [OMISSIS]
  </code></pre>
  
  <p>can someone please tell what i've done wrong, thanks</p>