Posted: Tue Jul 27, 2004 10:10 pm
I think it's more that the while loop is an infinite loop, always setting $dir to "Users", $warning isn't set anywhere in there, so it's blank when it hits the fopen call.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
$warnings = array($_POST[q],$_POST[q2],$_POST[q3],$_POST[q4],$_POST[q5]);
foreach ($warnings as $w){
$warning = $w;}
//then the file write code
$rContents = "$filename";
$dir = "Users";
if (!$handle = fopen("$dir/$warning", 'awb+')) {
echo "<br>Cannot open file ($warning)";
exit;
}
// Write content to file.
if (fwrite($handle,"\r\n $rContents") === FALSE) {
echo "<br>Cannot write to file ($warning)";
exit;
}
echo "<br>Success, wrote ($rContents) to file ($warning)";
fclose($handle);
?>