make input file variable <p>I will like to get this script process csv files <code>"$inputFilename = 'westmike1.csv';"</code> with different names, when a import link to the file is click. At the moment I can go beyond process one file, and for me to use this script at that it will make me duplicate them. </p> <p>Please I need an advice on this thanks.</p> <pre><code>error_reporting(E_ALL | E_STRICT); ini_set('display_errors', true); ini_set('auto_detect_line_endings', true); $inputFilename = 'westmike1.csv'; $outputFilename = 'westmike1.xml'; // Open csv to read $inputFile = fopen($inputFilename, 'rt'); // Get the headers of the file $headers = fgetcsv($inputFile); // Create a new dom document with pretty formatting $doc = new DomDocument(); $doc-&gt;formatOutput = true; // Add a root node to the document $root = $doc-&gt;createElement('rows'); $root = $doc-&gt;appendChild($root); // Loop through each row creating a &lt;row&gt; node with the correct data while (($row = fgetcsv($inputFile)) !== FALSE) { $container = $doc-&gt;createElement('row'); foreach ($headers as $i =&gt; $header) { $child = $doc-&gt;createElement($header); $child = $container-&gt;appendChild($child); $value = $doc-&gt;createTextNode($row[$i]); $value = $child-&gt;appendChild($value); } $root-&gt;appendChild($container); } $strxml = $doc-&gt;saveXML(); $handle = fopen($outputFilename, "w"); fwrite($handle, $strxml); fclose($handle); $xml = simplexml_load_file('westmike1.xml') or die("ERROR: Cannot create SimpleXML object"); // open MySQL connection $connection = mysqli_connect("localhost", "mikeshop", "sho****", "mike_shop") or die ("ERROR: Cannot connect"); // process node data // create and execute INSERT queries </code></pre>