Creating Files

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
robjime
Forum Commoner
Posts: 46
Joined: Sat Apr 03, 2004 12:26 pm
Location: the RO

Creating Files

Post by robjime »

I'm getting a parse error on line 3

Code: Select all

<?php
$numb = $_POST['numb']
$desc = $_POST['desc']
$filename = "$numb.htm";
$somecontent = "<html><head><title>".$numb."</title><body>".$desc."</body></html>";
   if (!$handle = fopen($filename, 'x')) {
         echo "Cannot open file ($filename)";
         exit;
   }

   
   if (fwrite($handle, $somecontent) === FALSE) {
       echo "Cannot write to file ($filename)";
       exit;
   }
   
   echo "Success, wrote ($somecontent) to file ($filename)";
   
   fclose($handle);
                   
} else {
   echo "The file $filename is not writable";

?>
its hosted at http://www.hostultra.com/~robjime/ps/newcd.htm

?>
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

$numb = $_POST['numb']
$desc = $_POST['desc']

Both missing the ; on the end.
Post Reply