You have a few small errors in your script. Try the following, which I think is a slightly better way of doing it:
<?php
$fp = fopen("file.txt","a");
if($fp) {
$stringtowrite=$naam."|".$email."|".$lijst."|".$number;
fwrite($fp, $stringtowrite);
fclose($fp);
}
else
{
print "error! The file could not be opened";
exit;
}
if ($number == 100000)
{
echo 'U have won!';
} else
{
echo 'Sorry, you haven\'t won anything!';
}
?>
Also the main problem lies with permissions, but not the file, the directory. Make sure that the directory has write permissions.