title: Sending multiple codes to an email depending on the quantity [PHP]
body: <p>I am trying to create a script where I can sell my key codes/licence codes to people. Right now I have figured a way for the php script to read off a text file and output it then delete the code/key in the text file.</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  $content = file('test.txt');
  echo $content[0];  
  $file = "test.txt";
  $line = 0;
  
  $array = file($file);
  unset($array[$line]);
  $fp = fopen($file, 'w+');
  
  foreach($array as $line) 
      fwrite($fp,$line); 
  
  fclose($fp);
  ?&gt;
  </code></pre>
  
  <p>My question is that is there a way to integrate PayPal with this and they can pick multiple quantities. So for example if they picked 5 codes in the checkout a php script would email them 5 codes and delete them from the list. </p>