koolaid Posted June 19, 2008 Share Posted June 19, 2008 I don't know why, but i keep getting "[type function]" in my text file. Can anyone tell me why? <?php $folder = "./files/"; if(!is_dir($folder)) mkdir($folder, 0755); $coma = ","; $mode = file_exists($folder.'user_input.txt')?'a':'w'; // append if file exists otherwise create it $fp = fopen($folder.'user_input.txt',$mode); // open file foreach($_POST as $V) { if($K != '_searchKey') { fwrite($fp, " $V$coma ")."\r\n"; // dump the contents of the $_POST array to the file } } fclose($fp); ?> example of what i keep getting [type Function], stuff from field 1, field 2 text, field 3 text, Link to comment https://forums.phpfreaks.com/topic/111002-solved-writing-text-file-and-keep-getting-type-function/ Share on other sites More sharing options...
DarkWater Posted June 19, 2008 Share Posted June 19, 2008 I think it's fairly obvious that [type Function] is contained in the $_POST array, so find out where. =/ Link to comment https://forums.phpfreaks.com/topic/111002-solved-writing-text-file-and-keep-getting-type-function/#findComment-569562 Share on other sites More sharing options...
koolaid Posted June 19, 2008 Author Share Posted June 19, 2008 Yeah obvious, but i am really new to this. I will keep trying. Thanks for pointing me in the right direction. Link to comment https://forums.phpfreaks.com/topic/111002-solved-writing-text-file-and-keep-getting-type-function/#findComment-569571 Share on other sites More sharing options...
koolaid Posted June 19, 2008 Author Share Posted June 19, 2008 ok here is the skinny. Dark water was right. I am getting my variables from a flash form. Well flash returns extra variables w/ the form. It's called "Object DEPROTO:" documentation on this can be found here: http://www.senocular.com/flash/actionscript.php?file=ActionScript_1.0/Prototypes/Object/deproto.as usually you never encounter this as an issue because you are posting particular variables, and you never reffer to the extra variables that flash posted, but since i was posting all variables w/o reffering to any of them specifically it was posting the extra stuff. So i changed me php to this and it works fine <?php $var1 = $_POST["name1"]; $var2 = $_POST["email1"]; $var3 = $_POST["input3"]; $folder = "./files/"; if(!is_dir($folder)) mkdir($folder, 0755); $coma = ","; $mode = file_exists($folder.'user_input.txt')?'a':'w'; // append if file exists otherwise create it $fp = fopen($folder.'user_input.txt',$mode); // open file fwrite($fp, "$var1$coma $var2$coma $var3$coma"); // dump the contents of the $_POST array to the file fwrite($fp, "\r\n"); fclose($fp); ?> Link to comment https://forums.phpfreaks.com/topic/111002-solved-writing-text-file-and-keep-getting-type-function/#findComment-569625 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.