Jump to content

Save form data with different file names


ianco

Recommended Posts

Hi all,

I want to create a form with a textbox and text area that can save the data as a txt file. I want the textbox entry to be the name of the file; ie. if the entry was joebloggs then the file would be joebloggs.txt

 

The php i have so far is

 

<?php

$wam = htmlspecialchars($_POST['wam']) ;

$info = htmlspecialchars($_POST['info']) ;

 

$myFile = "temp.txt";

$fh = fopen($myFile, 'w') or die("can't open file");

$news = stripslashes($_POST['news']);

htmlspecialchars($news, ENT_NOQUOTES);

fwrite($fh, $news);

fclose($fh);

?>

 

So how would i modify it to allow the wam output to be the name of the file?

 

Cheers

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.