I need to read an excel file in my codeigniter project. This is my example file.
I need to rewrite dynamic content(eg %VAR1 and %VAR2 ) inmsg
field with the content in corresponding column.
ie The msg content in first row will be Dear (John) this I sa demo message. 8952 test
.
The number of dynamic content may vary from 0 to n.(%VAR1, %VAR2, %VAR3 etc).
Please help me to do this
This is my code:
$filename=$_FILES["contactFile"]["tmp_name"];
if (($handle = fopen($filename, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
echo "<p> $num fields in line $row: <br /></p>
";
$row++;
for ($c=0; $c < $num; $c++) {
echo $data[$c] . "<br />
";
}
}
fclose($handle);
}
it displays content in each column. But how do i replace with another column value