title: create a file with name using php form
body: <p>Filling a form wich gave two parts, filename and text i need to create a file in the html directory wich will have name $filename and get the text inside it that i put in $text.
  unfortinatly i cant make it work
  any help please:</p>
  
  <p>FORM CODE:</p>
  
  <pre><code>&lt;form method="post" action="createfile.php"&gt;
  &lt;font size"3"&gt;&lt;b&gt;File name:&lt;/b&gt; &lt;/font&gt;
  &lt;br /&gt;&lt;input type="text" size="15" name="filename" id="filename"&gt;&lt;br /&gt;
  &lt;font size"3"&gt;&lt;b&gt;File data:&lt;/b&gt; &lt;/font&gt;
  &lt;div id="dat"&gt;&lt;textarea name="thedata" id="thedata" cols="30" rows="15"&gt;&lt;/textarea&gt;&lt;/div&gt;
  &lt;div id="sub" style="position:absolute; left: 25"&gt;
  &lt;input type="submit" value=" Create "&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>the createfile.php CODE:</p>
  
  <pre><code>&lt;?php 
  $name= $filename; 
  $data= $thedata; 
  if ( $file &amp;&amp; $data ) { 
  $fp = fopen($file, "w");  
  fwrite($fp, "&lt;br&gt;"); 
  fwrite($fp, $data); 
  fclose($fp); 
  } 
  else 
  { echo 'no text entered'; 
  } 
  ?&gt;
  </code></pre>
  
  <p>Thanks for help</p>