I have a small script to export my customer data to a text file. It works great!
I thought i'd make it a little more advanced for some friends of mine, but I'm getting lost in what's best.
I want to add some dropdowns to the form that allows me to choose the order of the columns. Is this doable? I've been playing with it and so far I'm not successful:
<?php
if (!$HTTP_GET_VARS['submit'])
{
echo "Export and Save Customer Data onto your Local Machine";
echo '<form action="'. $phpself.'">';
echo '<input type="submit" value="Export" name="submit"></form>';
} else {
$contents="Firstname \t Lastname \t Email \t Newsletter \n \n";
$user_query = mysql_query('select c.*, adb.* from customers as c left join address_book as adb on c.customers_id = adb.customers_id');
while($row = mysql_fetch_array($user_query))
{
$contents.=$row[customers_firstname]."\t";
$contents.=$row[customers_lastname]."\t";
$contents.=$row[customers_email_address]."\t";
$contents.=$row[customers_newsletter]."\n";
}
Header("Content-Disposition: attachment; filename=export.txt");
print $contents;
}
?>