PHP script wont work because of wrong variable type
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/11610974/ajax-to-php-wont-work">Ajax to php wont work</a>  </p>
</blockquote>



<p>Trying to dedupe csv file. An ajax request is sent to this php file. Fiddler shows the response is are two errors.</p>

<pre><code>$("#csv_dedupe").live("click", function(e) {
    file_name = 'C:\\server\\xampp\\htdocs\\Gene\\IMEXporter\\include\\files\\' + $("#IMEXp_import_var-uploadFile-file").val();
    $.post($_CFG_PROCESSORFILE, {"task": "csv_dupe", "file_name": file_name}, function(data) {
        alert(data);
    }, "json")
});
</code></pre>

<p>.</p>

<pre><code>if ($task == "csv_dupe") {
$input_filename = $_REQUEST["file_name"];
$output_filename = $_REQUEST["file_name"];

$input_file = fopen($input_filename, 'r');
$output_file = fopen($output_filename, 'w');
$email_addresses = array();
// Read the header
$headers = fgetcsv($input_file, 0);
fputcsv($output_file, $headers);
// Flip it so it becomes name =&gt; ID
$headers = array_flip($headers);

// Read every row
while (($row = fgetcsv($input_file, 0)) !== FALSE)
{
    $email = $row[$headers['email']];
    // Do we already have this email address?
    if (isset($email_addresses[$email]))
        continue;

    // Mark this email as being found
    $email_addresses[$email] = true;
    // Write it to the output
    fputcsv($output_file, $row);
}
}
</code></pre>

<pre class="lang-none prettyprint-override"><code>Warning: fputcsv() expects parameter 2 to be array, boolean given in C:\server\xampp\htdocs\Gene\IMEXporter\include\IMEXporter_processor.php on line 45

Warning: array_flip() expects parameter 1 to be array, boolean given in C:\server\xampp\htdocs\Gene\IMEXporter\include\IMEXporter_processor.php on line 47 "success"
</code></pre>
