jdock1 Posted June 29, 2009 Share Posted June 29, 2009 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! Link to comment https://forums.phpfreaks.com/topic/164045-how-can-i-write-to-a-file-from-user-submitted-data/ Share on other sites More sharing options...
haku Posted June 29, 2009 Share Posted June 29, 2009 Show us your code mate. Link to comment https://forums.phpfreaks.com/topic/164045-how-can-i-write-to-a-file-from-user-submitted-data/#findComment-865380 Share on other sites More sharing options...
jdock1 Posted June 29, 2009 Author Share Posted June 29, 2009 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 Link to comment https://forums.phpfreaks.com/topic/164045-how-can-i-write-to-a-file-from-user-submitted-data/#findComment-865436 Share on other sites More sharing options...
haku Posted June 30, 2009 Share Posted June 30, 2009 fwrite($fp, $w); When you add single quotes around the variable, it turns it into text. Which means you were writing the text of a dollar sign followed by a w, instead of writing the contents of $w. Link to comment https://forums.phpfreaks.com/topic/164045-how-can-i-write-to-a-file-from-user-submitted-data/#findComment-866089 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.