I'm trying to write in a txt file the data i get from a
html form, but I get this error: Warning: fopen(/var/www/4/datos.txt): failed to open
stream: Permission denied in /var/www/4/ComprobacionFormulario.php on line 13 Warning:
fwrite() expects parameter 1 to be resource, boolean given in
/var/www/4/ComprobacionFormulario.php on line 16 Warning: fclose() expects parameter 1
to be resource, boolean given in /var/www/4/ComprobacionFormulario.php on line
17
'datos.txt' Is the file where i'm trying to
write. Here is my php
code:
error_reporting(E_ALL);
ini_set('display_errors',
true);
$des=$_POST['description'];
$cant=$_POST['quantity'];
$prec=$_POST['price'];
$nombrearchivo="datos.txt";
$content="Description:
$des\tQuantity: $cant\tPrice: $prec\n";
$handle=fopen($nombrearchivo,
'w');
fwrite($handle,
$content);
fclose($handle);
No comments:
Post a Comment