Hello friend,

   I have a registration form and a admin panel for that, In admin panel we can see the list of registered users. I can filter user details by search but i cannot export searched results to .xls or .csv format. kindly help me...!!!

Thank you.

6 Years
Discussion Span
Last Post by gabrielcastillo

Maybe google something like html tables to csv. But that is assuming your stuff is in a table as opposed to be styled with css.

Either way if you know what you're doing you can write a rudimentary .csv dump.

Failing that you can look to free excel exporters which would cover more complex examples...


This will export .xls file all you would need to do is create your own query. I created a form with a hidden field value of id number and a download input button, so when user clicks on the download button, the id gets sent to my query and exports the .xls file.

$q = mysql_query("SELECT * FROM tablename WHERE id='$id'");

header( "Content-Type: application/vnd.ms-excel" );
header( "Content-disposition: attachment; filename=spreadsheetfilename.xls" );

echo 'Fieldname' . "\t" . 'Fieldname' . "\t" . 'Fieldname' . "\t" . 'Fieldname' . "\n";
while($res = mysql_fetch_array($q)){
    echo $res['Fieldname'] . "\t" . $res['Fieldname'] . "\t" . $res['Fieldname']. "\t" . $res['Fieldname'] . "\n";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.