PHP Forms with Write

Results 1 to 2 of 2
  1. #1
    Infraction Banned Josh is offline
    Grand MasterRank
    Dec 2004 Join Date
    8,333Posts

    PHP Forms with Write

    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.


  2. #2
    Grand Master FragFrog is offline
    Grand MasterRank
    Aug 2004 Join Date
    The NetherlandsLocation
    5,629Posts
    You're a noob

    (already helped him on MSN fix it )



Advertisement