Hi. I am new in coding and sufferin from some basic issues. I've been trying to write and searching codes for writting into xls file for 3 days but could not find a suitable one. The problem is:


I created a page with textareas and submit/reset button like that and I've got an excel table in document classgrades.xls. The colums of that table are named Name, Midterm1, Midterm2, Final, Attendance and Average.

Now, I am trying to write a code which automatically adds a new row and writes user inputs from textares into the excel table. If you help I appreciate very much. Thanks.

Most common approach is to store the data from each submitted form in a database table and then create an excel file upon a request (e.g. the administrator can download the excel file by clicking a link).

I hope you have database connection already set and script made to save te data to the database. To export database data to excel search Daniweb or Web by 'php export to excel' or similar term. You should find tons of examples. This is the first one I found on DW: http://www.daniweb.com/web-development/php/threads/124300/how-to-php-export-to-excel

A note on your form: I don't think textareas are the proper form field types for the data you collect. I guess for Name the input type="text" is more appropriate and for numeric values maybe select elements (drop down lists) are better. Textarea is suitable for free text of usually some lenght.

Also it is good to post the code you already have.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.