Is it possible to carry an array forward to make a filename
Posted: Mon Feb 02, 2004 8:44 am
I have a text box named $array[chat] in it is placed a random number, I would then like this number to be carried forward to the next page where the file created or accessed is the same name as the value of $array[chat].
script designed to write and read $array[chat]
script designed to write and read $array[chat]
Code: Select all
function WriteToFile($firstname){
$str= "{$arrayї'chat']}.txt";
$Open = fopen ($str,"a");
if($Open){
fwrite ($Open,"$firstname");
fclose($Open);
$Worked=True;
} else {
$Worked = False;
}
return $Worked;
}
function readfromfile(){
$str = "{$arrayї'chat']}.txt";
$Open = fopen ($str,"r");
if($Open){
print("<HR><B><font color=white><a href="#latest" style=text-decoration:none>Comments:(To see the latest comment click here)</B></A><BR>\n");
$data = file($str);
for($n = 0; $n<count($data); $n++){
$getline = explode("\t",$dataї$n]);
print("<B>$getlineї0]\t$getlineї1]<HR>\n");}
fclose($Open);
}else{
print("<font color=white><B>Unable to present previous comments!<HR><B><font color=white><a href="#latest" style=text-decoration:none>Comments:(To see the latest comment click here)</B></A><BR>\n");
}
}