Using the XML from Excel 2003, you can read data directly from spreadsheets that customers upload to your site.
Your customers' data can come from many different sources. Making it easy for them to get their data into your system can mean the difference between getting their business and having them go somewhere else for their data needs (and taking their money with them). Supporting data import from common data sources such as Excel can be a very compelling feature for customers.
This hack shows you how to save Excel spreadsheets in the new XML format supported by Excel and Microsoft Office 2003 and how to read that format and display the data back to the user. Figure 5-12 illustrates the flow between the browser (shown here as the computer) and the import system. The first page is index.php, which presents the Browse button. The user then selects an Excel XML file, which is submitted to the import.php page; that page returns an HTML rendering of the data in the file.
Figure 5-12. The flow of the Excel XML import
index.php (shown in Example 5-34) is responsible for getting the Excel data into your PHP scripts.
Example 5-34. The PHP for getting Excel data into your scripts
<html> <body> <form enctype="multipart/form-data" action="import.php" method="post"> Excel XML file: <input type="hidden" name="MAX_FILE_SIZE" value="2000000" /> <input type="file" ...