Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

PHP Forms with Write

Custom Title Activated
Member
Joined
Dec 31, 2004
Messages
4,091
Reaction score
25
Hey Guys,

Basically what I am trying to do is to create a form where someone will enter their name or whatever, then save that name as a .txt file. Then it will input some data into that text file... well have a few issues.

Form:
Code:
<h1 align="center">Name Validator </h1>    
	
	<form action="proc.php" method="post">
File Name:
  <input name="name" type="text" />
  <br>
 Text:
  <input name="text" type="text" />
<input type="submit" value="GO!" />
</form>

proc.php:
Code:
<?php
$myFile = "echo $_POST['name'].txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "echo $_POST['text']";
fwrite($fh, $stringData);
fclose($fh);
?>

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in W:\www\proc.php on line 4

So confused, this is my first time doing this sort of thing.
 
Custom Title Activated
Member
Joined
Aug 8, 2004
Messages
3,892
Reaction score
20
You're a noob :tongue:

(already helped him on MSN fix it :wink:)
 
Back
Top