Hi, nice to meet everyone, im Arekkusu and im new to the forums.
I have a slight problem..hopein g you guys and gals can help with. Its about trying to get a variable ($i), to increase by one every time a number of strings from the $POST array is written to a flat file. Does that make sense?
This what I got so far.
[PHP]
$racerDetails = $_POST;
//write to file//
$min = 0;
$max = 20;
$i = 0;
if($i >= $min)
{
if($i < $max)
{
$file = "Comments.t xt";
$handle = fopen($file, "a");
fwrite($handle, $i.$racerDetail s["Name"]." ".$racerDet ails["Bike"]."\n");
fclose($handle) ;
$i++;
}
}
[/PHP]
So what should basically happen is that once the $_POST array values specified have been written to a flat file, it should increase the variable i by 1. After the next time data is written to the flat file, var i should equal 2, and so on and so on until it reaches 20.
I tried using a for loop but I couldnt work out how to stop it once it had incremented i by 1, so it just printed the same values to the flat file 20 times.
Any ideas?
If you need me to exlain anything just say, apologies as I'm not to great with getting my thoughts down on paper...or forum..lol.
Thanks in advance.
Arekkusu.
I have a slight problem..hopein g you guys and gals can help with. Its about trying to get a variable ($i), to increase by one every time a number of strings from the $POST array is written to a flat file. Does that make sense?
This what I got so far.
[PHP]
$racerDetails = $_POST;
//write to file//
$min = 0;
$max = 20;
$i = 0;
if($i >= $min)
{
if($i < $max)
{
$file = "Comments.t xt";
$handle = fopen($file, "a");
fwrite($handle, $i.$racerDetail s["Name"]." ".$racerDet ails["Bike"]."\n");
fclose($handle) ;
$i++;
}
}
[/PHP]
So what should basically happen is that once the $_POST array values specified have been written to a flat file, it should increase the variable i by 1. After the next time data is written to the flat file, var i should equal 2, and so on and so on until it reaches 20.
I tried using a for loop but I couldnt work out how to stop it once it had incremented i by 1, so it just printed the same values to the flat file 20 times.
Any ideas?
If you need me to exlain anything just say, apologies as I'm not to great with getting my thoughts down on paper...or forum..lol.
Thanks in advance.
Arekkusu.
Comment