Hi guys,
After i read the source file (COUNTRY.TXT) and made some changed, then use the function file_put_contents() and save a new file (updateCountry.txt) , getting error message “Notice: Undefined offset: 5999 in C:\wamp\www\WebForm\July\SaveRoute.php on line [color=red]28[/color]”
P.S line 28 code = $totalparts[0][“desc”][$i]." ".PHP_EOL;
and i checked around 25-30% data wrote in the updateCountry.txt, other 70-75% didn’t !
Please help, thanks.
[php]
<?php $count=count($_POST['country']); $filehandel="updateCountry.txt"; //clean up the file file_put_contents($filehandel, ""); $totalparts[]=array("country"=>$_POST['country'], "zone"=>$_POST['zone'], "carrier"=>$_POST['carrier'], "lengthD"=>$_POST['lengthD'], "desc"=>$_POST['desc']); for($i=0;$i<$count;$i++) { $line= $totalparts[0]["country"][$i]." ". $totalparts[0]["zone"][$i]." ". $totalparts[0]["carrier"][$i]." ". $totalparts[0]["lengthD"][$i]." ". $totalparts[0]["desc"][$i]." ".PHP_EOL; file_put_contents($filehandel, $line, FILE_APPEND); } ?>[/php]
Brgds/Brandon Chau