Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8252801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:39:31+00:00 2026-06-08T00:39:31+00:00

In my web site I’m creating a table from the mysql data and then

  • 0

In my web site I’m creating a table from the mysql data and then now I want to add a export button buttom of the table so that a user will be able to download the data as an CSV file.

To do that I wrote dummy form:

<form action="<?=$_SERVER['PHP_SELF'];?>" method="post">
    <input type="submit" name="submit" value="Click Me">
</form>

And at the top of the php file I have:

if(isset($_POST['submit'])) {
    export();
}

In my export function I have some mysql stuff, I’m creating an array and pushing data into it, and then:

$header = array('name', 'date', 'total', 'success', 'opens', 'clicks', 'success_rate', 'open_rate', 'CTO', 'CTR')
$fp = fopen('exportme2.csv', 'w');
fputcsv($fp, $header);

foreach ($data as $lines) {
        fputcsv($fp, $lines);
}
fclose($fp);

After I click to export button, I’ll have exportme2.csv file, however it is empty !
The data may be wrong so that there won’t be anything but at least I should have the header names.

Can you help me about this issue please ?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T00:39:32+00:00Added an answer on June 8, 2026 at 12:39 am

    It wasn’t posting anything because it submit the page so that when the page refreshed all of my arrays are become empty.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Straight from the w3schools web site, why would I want to put these items
I'm creating web site in asp.net web forms. I added validation to fields in
My web site want to be open IE7 and above .If IE 6 ,I
I migrated a Web Site project (with Web Deployment project) from VS2008 to VS2010.
On a PHP-based web site, I want to send users a download package after
I have a web site using apache httpd as the server and mysql as
I've got a web site sending someone a confirmation email. Now in the email
My web site was working flawless in the old Host , But now i
Which web site tracking tools do not have Report Data Sampling? Currently, I'm using
I have a small web site where I maintain user data, and I maintain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.