Jump to content

[SOLVED] writing text file and keep getting [type function]


koolaid

Recommended Posts

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,

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);

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.