Jump to content

How can I write to a file from user submitted data?


jdock1

Recommended Posts

Meaning, using fopen or fwrite or whatever, is it possible to make a form with a textbox and a submit button, the textbox holds a variable, whatever I write into that textbox it writes to a file on the server?

 

Is this possible?

 

I tried a few ways, but it would pretty much just write the variable name to the file, so if I called the textbox input $w, it would just write to the file "$w"

 

Im kinda lost here.

 

Can anybody help me out?

 

THanks!

Sorry

 

There are two seperate files,

 

here is the the form :

 

<?
$w = $_GET["data"]
?>
<form action="fp.php" method="get">
<input type="text" name="data">
<input type="submit" value="Write">
</form>";

 

fp.php:

<?php
$fp = fopen('data.txt', 'w');
$w = $_GET['data'];
fwrite($fp, '$w');
fclose($fp);


?>

 

somebody please help me out here, im having a hell of a time tryna figure this out

 

 

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.