Jam-ez
28-11-2008, 08:16 PM
Hi,
I currently have a script which writes to a file called pollinfo.php;
<?php
$vote = $_POST['group1'];
if ($vote == '1')
{
$vote = 'fifth';
$file = @fopen("pollinfo.php", "w");
$data = "\nOne vote for the $vote \n";
@fwrite($file, $data);
@fclose($file);
}
else if ($vote == '2')
{
$vote = 'thirteenth';
$file = @fopen("pollinfo.php", "w");
$data = "\nOne vote for the $vote \n";
@fwrite($file, $data);
@fclose($file);
}
echo("<br /><br />Thank you for sending in your opinion!");
?>
However, every time someone votes, the poll overwrites the current data. Is there anyway to keep the current data and just continue as a new set of data, or would I have to open the file, read what it says, and add it to the $data variable?
Regards,
James.
I currently have a script which writes to a file called pollinfo.php;
<?php
$vote = $_POST['group1'];
if ($vote == '1')
{
$vote = 'fifth';
$file = @fopen("pollinfo.php", "w");
$data = "\nOne vote for the $vote \n";
@fwrite($file, $data);
@fclose($file);
}
else if ($vote == '2')
{
$vote = 'thirteenth';
$file = @fopen("pollinfo.php", "w");
$data = "\nOne vote for the $vote \n";
@fwrite($file, $data);
@fclose($file);
}
echo("<br /><br />Thank you for sending in your opinion!");
?>
However, every time someone votes, the poll overwrites the current data. Is there anyway to keep the current data and just continue as a new set of data, or would I have to open the file, read what it says, and add it to the $data variable?
Regards,
James.