I have created this script based off of a youtube tutorial:
<?php
if (($handle = fopen("guide.csv","r")) !== FALSE)
{
$impairment = [];
$provider = [];
$description = [];
while (($data = fgetcsv($handle,1000,",")) !== FALSE)
{
$impairment[] = $data[0];
$provider[] = $data[1];
$description[] = $data[2];
}
fclose($handle);
}
?>
and then I am attempting to echo the HTML in arrays and loop it for each row:
<?php
$arraySize = count($name);
$i = 0;
while($i < $arraySize)
{
echo "<section class=\"section\">";
echo "<p class=\"title\"><a href=\"#\"><i class=\"icon-down-open-big\"></i>" .$impairment[$i]."</a></p>";
echo "<div class=\"content\"><ul class=\"side-nav\"><li><div><table class=\"statustab\"><tr>";
echo "<td><h1>" .$provider[$i]. "</h1></td>";
echo "<td><p class=\"statusp\"><span></span></p></td></tr><tr>";
echo "<td><p>" .$description[$i]. "</p></td>";
echo "</tr></table></div></li></ul></div></section>";
$i++;
}
?>
My CSV file is simply this:
Addisons Disease,Phoenix Safe Harbor,Standard to Decline
ADHD/ADD,Phoenix Safe Harbor,Standard
ADLs (requires assistance),Phoenix Safe Harbor,Decline
But it seems something isn't right with this code and I can't get it to work properly. I've looked at several PHP manuals but for this specifically I cannot get the variables to work.
Any help is appreciated. This will be the finished product populated with a CSV file: http://247medplan.com/grid/