0

i want to write data accepted in a form to a text file. this is the code i am using.

$file=fopen("data.txt","a+");
fwrite($file," whatever i want written");
fclose($file);

but nothing is being written to the file.
the text files are in the same place as the php pages.
does anyone know why its not working?

heres the whole thing if u need it.

<?php

$val1= $_POST["val1"];
$val2=$_POST["val2"];

$file=fopen("idata.txt","a+");
fwrite($file,"whatever i want it to write ");
fclose($file);


switch($val1)
{
case 1:

$file=fopen("data.txt","a+");
fwrite($file,"whatever i want it to write");
fclose($file);
break;

case 2:

$file=fopen("data.txt","a+");
fwrite($file,"whatever i want it to write");
fclose($file);
break;

.
.
.


default:

$file=fopen("data.txt","a+");
fwrite($file,"whatever..");
fclose($file);
break;

}



?>

thanks

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by itnagusak
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.