How do I save the content in the form as an Excel file?

Source: Internet
Author: User
Tags php excel
How do I save the content in the form as an Excel file? there is Now, I want to create a button. click the button to bring up the dialog box






You can search for the PHP excel class library online.

Are you writing table list data into excel? Search for the php excel class.

Are you writing table list data into excel? Search for the php excel class.

Yes. The main reason is that php is a temporary task. I have never done it before, and I have to search for any function I need. this is a headache.

There is also how to make the html pop-up save as dialog box, and then execute the code .... I don't know about this ..

PHP excel export
Here is an example.

Use header directly



First, submit according to the normal form, and then receive it in php, and then save the received content as an excel file through the excel class of php.

$ Filename = "members ". date ('ymmd'); $ member = $ this-> Members_model-> member_for_export (); header ("Content-type: application/vnd. ms-excel; charset = utf-8 "); header (" Content-Disposition: attachment; filename=$filename.xls "); echo iconv ('utf-8', 'gbk ', 'member list '). "\ t \ n"; echo iconv ('utf-8', 'gbk', 'number '). "\ t"; echo iconv ('utf-8', 'gbk', 'Email address '). "\ t \ n"; foreach ($ member AS $ key => $ value) {$ order_by = $ key + 1; echo iconv ('utf-8 ', 'gbk', $ order_by ). "\ t"; echo iconv ('utf-8', 'gbk', $ value ['email ']). "\ t"; echo "\ n";} exit;
Save the data as an Excel file. How can I complete this .... My younger brother has just been in touch with php. This problem has been bothering me for a long time. I am very grateful .... Reply to discussion (solution) You can refer to the above code to directly copy it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.