hi i've got this code that writes data to a text file. When i test it with a standard array eg array(1,2,3) it works perfectly fine but when i try it with $_POST['myData'] i get the error message
Warning: Invalid argument supplied for foreach() in /home/theau10/public_html/resources/captionSaveB.php on line 23
Warning: Invalid argument supplied for foreach() in /home/theau10/public_html/resources/captionSaveB.php on line 38
Warning: Invalid argument supplied for foreach() in /home/theau10/public_html/resources/captionSaveB.php on line 53
here is my code.....can someone point me to the incorrect code....i cant see where its going wrong
-
$file = "upload/$random_digit/gallery.txt";
-
$imgHandle = fopen($file, 'w+') or die("can't open file");
-
-
$iv= 1;
-
$lQ = ',';
-
$imgAry = $_POST['imageT'];
-
-
$stringData = "&imgLoc=";
-
fwrite($imgHandle, $stringData);
-
-
foreach($imgAry as $key => $value){
-
fwrite($imgHandle,$value .$lQ);
-
}
-
-
fclose($imgHandle);
-
-
$tmbHandle = fopen($file, 'a+') or die("can't open file");
-
-
$iv= 1;
-
$tQ = ',';
-
$tmbAry = $_POST['thumbnailT'];
-
-
$stringData = "&tmbLoc=";
-
fwrite($tmbHandle, $stringData);
-
-
foreach($tmbAry as $key => $value){
-
fwrite($tmbHandle,$value .$tQ);
-
}
-
-
fclose($tmbHandle);
-
-
$capHandle = fopen($file, 'a+') or die("can't open file");
-
-
$iv= 1;
-
$cQ = ',';
-
$capAry = $_POST['captionT'];
-
-
$stringData = "&imgCap=";
-
fwrite($capHandle, $stringData);
-
-
foreach($capAry as $key => $value){
-
fwrite($capHandle,$value .$cQ);
-
}
-
-
fclose($capHandle);
-