[php]
I’m pretty sure you’re missing a period Different. Look after $_POST[“name”]. I think that’s the problem.
[php]fwrite(“http://fwin.co.cc/imgboard/feedback/feedback” . $num . “.txt” , $_POST[“Name”] " " . $_POST[“fb”] " " . $_POST[“userip”] );[/php]
Should be:
[php]fwrite(“http://fwin.co.cc/imgboard/feedback/feedback” . $num . “.txt” , $_POST[“Name”] . " " . $_POST[“fb”] . " " . $_POST[“userip”] );[/php]
Actually most of that code should not even work.
fopen( $filename, $mode [, $use_include_path = false [, $context ] ] ) - This is ok
fwrite( $handle, $string [, $length ] ) - All your uses are incorrect
fclose( $handle ) - Again your usage is incorrect
[php]
<?php if(file_exists('counter.txt')) $counter=intval(file_get_contents('counter.txt')); else $counter=1; file_put_contents('feedback-'.$counter.'.txt', $_POST["Name"] . " " . $_POST["fb"] . " " . $_POST["userip"] .PHP_EOL); file_put_contents('counter.txt',++$counter) ?>[/php]
file_get_contents/put_contents are very useful php functions, when you only need 1 read/write of a file.
fopen/fgets/fwrite/fclose are really used when you have huge amount of data in a file and have to chunk read/write, working with binary/flatfile db files, or using some random access system.
and note the ++$counter, not $counter++
there is a big difference, one does the increment before releasing the value, and the other does it it after releasing the value. In this instance it really doesn’t matter as that is as far as the evaluation goes, but in bigger evaluations it makes a huge difference