0

Possible Duplicate:
Save PHP variables to a text file

I need help to take data entered into an html form and create a new file with the name of the file being what the user enters in for there name and then save that text file into a folder called forms or something.

Community
  • 1
  • 1
Jake Funchion
  • 73
  • 3
  • 8

1 Answers1

0
$fileName = $_POST['fileName'];  //posted value of text box
$userName =$_POST['userName'];   //posted value of text box
$myFile = $fileName.".txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $userName;
fwrite($fh, $stringData);
fclose($fh);
vivek salve
  • 991
  • 1
  • 9
  • 20