How to create a txt file on local computer.

How to create a txt file on local computer.

Hi everybody.
I'm here again because I need help to create a txt file on local computer (I really do not know if it's possible).
The data that I should save on drive C they come from mysql table, I put them in html table, I generate a excel file. and then I should create a txt file with the contents of some <td>.

Thanks in advance.

Tegatti.

I post the php file:

$filename="elenco";
header ("Content-Type: application/vnd.ms-excel");
header ("Content-Disposition: inline; filename=$filename");

$sql_scuola=mysql_query("SELECT * FROM amministratori WHERE user_id=2 ");
$row_scuola=mysql_fetch_array($sql_scuola);

$sql_seconda=mysql_query("SELECT * FROM classi WHERE num=2 ORDER BY classe");
while ($row_seconda=mysql_fetch_array($sql_seconda))
{
    $IdClasse = $row_seconda['idclasse'];
?>                                                                                                                 
<table>
    <thead> 
     <tr>
       <th>Cognome (solo controllo)          </th>
       <th>Nome (solo controllo)             </th>
       <th>codice fornitore                  </th>
       <th>versione                          </th>
       <th>meccanografico                    </th>
       <th>meccanografico plesso             </th>
       <th>livello                           </th>
       <th>sezione                           </th>
       <th>codice SIDI                       </th> 
       <th>progressivo studente              </th>
       <th>stato studente                    </th>
       <th>sesso                             </th>      
       <th>mese di nascita                   </th>
       <th>anno di nascita                   </th> 
       <th>luogo di nascita                  </th>
       <th>età di arrivo in Italia           </th>
       <th>disabilità o DES                  </th>       
       <th>voto scritto di italiano          </th>
       <th>voto orale o unico di italiano    </th> 
       <th>voto scritto di matematica        </th>
       <th>voto orale o unico di matematica  </th>
       <th>N. ore settimanali totali         </th>
       <th>N. ore settimanali di italiano    </th> 
       <th>N. ore settimanali di matematica  </th>       
     </tr>
   </thead>
   <tbody>   
<?php       
  $ind=0;   
  $sql=mysql_query("SELECT * FROM studenti WHERE ClasseStudente='$IdClasse' ORDER BY CognomeStudente, NomeStudente");
  while ($row=mysql_fetch_array($sql))
  {   
      $IdStudente = $row['IdStudente'];
      $ind++;              
      $nascita   =$row['DataStudente'];             
      $array     = explode("-", $nascita);
     
        $sql_ita=mysql_query("SELECT * FROM scrutini WHERE IdStu='$IdStudente' AND IdMat='A050-3' ");
         $row_ita=mysql_fetch_array($sql_ita);
         
      $sql_mat=mysql_query("SELECT * FROM scrutini WHERE IdStu='$IdStudente' AND IdMat='A048' ");
         $row_mat=mysql_fetch_array($sql_mat);   
     
      switch ($array[1])
        {
            case 1:   $mese="Gennaio";   break;
             case 2:   $mese="Febbraio";  break;
             case 3:   $mese="Marzo";     break;
             case 4:   $mese="Aprile";    break;
            case 5:   $mese="Maggio";    break;
             case 6:   $mese="Giugno";    break;
            case 7:   $mese="Luglio";    break;
             case 8:   $mese="Agosto";    break;
             case 9:   $mese="Settembre"; break;
             case 10:  $mese="Ottobre";   break;
             case 11:  $mese="Novembre";  break;
             case 12:  $mese="Dicembre";  break;             
        }     
?>
      <tr>        
        <td><?php echo $row['CognomeStudente'];       ?></td>
        <td><?php echo $row['NomeStudente'];          ?></td>
        <td>CR01                                        </td>
        <td>201112                                         </td>
        <td><?php echo $row_scuola['codiceMinisteriale']?></td>
        <td>codice plesso                               </td>
        <td>10                                            </td>
         <td><?php echo $row_seconda['classe'];       ?></td>
        <td>6415873                                      </td>
        <td><?php echo $ind;                          ?></td>       
        <td>Frequentante                                </td>
        <td><?php echo $row['sesso'];                    ?></td>
        <td><?php echo $mese;                           ?></td> 
        <td><?php echo $array[0];                      ?></td>
        <td>Italia (o Repubblica di San Marino)            </td>
        <td>                                             </td>
        <td><?php echo $disa;                            ?></td>
        <td>Senza voto scritto                            </td>
        <td><?php echo $row_ita['votoAttribuito'];    ?></td>
        <td>Senza voto scritto                            </td>
        <td><?php echo $row_mat['votoAttribuito'];    ?></td>
        <td>Da 30 a 34 ore                               </td>
        <td>4 ore                                       </td>
        <td>4 ore                                       </td>
       

<?php
  }
?>
      </tr>
   </tbody>    
  </table>
<?php
  }
 
?>