Ver Mensaje Individual
  #4 (permalink)  
Antiguo 03/08/2009, 16:31
Avatar de hucasys
hucasys
 
Fecha de Ingreso: noviembre-2001
Ubicación: Bastante buena...
Mensajes: 816
Antigüedad: 23 años, 4 meses
Puntos: 3
Respuesta: Php form > .txt utf-8

He probado con el código de esta manera, pero sigue sin funcionar:
Código:
<?php
header ('Content-type: text/html; charset=utf-8');
  $saving = $_REQUEST['saving'];
  if ($saving == 1) { 
    $data = $_POST['data'];
	$file = "data.txt"; 

 
    $fp = fopen($file, "wb") or die("Couldn't open $file for writing!");
    fwrite($fp, $data) or die("Couldn't write values to file!"); 
 
    fclose($fp); 
    echo "Saved to $file successfully!";
  }
?>

<meta http-equiv="Content-type" value="text/html; charset=UTF-8" />
<form name="form1" method="post" action="form.php?saving=1">
  <textarea name="data" cols="100" rows="10">
  <?php
   
    $file = "data.txt";
    if (!empty($file)) {  
	  $file = file_get_contents("$file");
	  echo stripslashes($file);  
	}  
?>
  </textarea>
  <br>
  <input type="submit" value="Save">
</form>
Y me imprime el siguiente error:
Warning: Cannot modify header information - headers already sent by (output started at.........................

¿Ideas?
__________________
La manera en que resuelves el problema, es el problema.
ROBERT FRIPP