php variable displayed in DIV tag
Posted: Sat Aug 07, 2010 3:27 pm
Hello, this is my first post here. I am new to php. I am trying to open a .csv file and load parts of it into div tags in html code, which are set in a table. The code below will open the file and print it to the screen, but I can't seem to get values to my div tags. I've been stuck on this for days now please point me in the right direction.
<html>
<head>
<title>Freon Log Test 1</title>
<?PHP
$custname = array();
$hscinvoice = array();
$date = array();
$in = array();
$out = array();
$total = array();
$file_handle = fopen("FreonLogs/R22/8A52.csv", "r");
while (!feof($file_handle) ) {
$line_of_text = fgetcsv($file_handle, 1024);
$custname[1]=$line_of_text[0];
$hscinvoice[1]=$line_of_text[1];
$date[1]=$line_of_text[2];
$in[1]=$line_of_text[3];
$out[1]=$line_of_text[4];
$total[1]=$line_of_text[5];
print $line_of_text[0] . $line_of_text[1]. $line_of_text[2] . "<BR>";
}
fclose($file_handle);
?>
</head>
<body>
<table border="1" width="60%">
<tr>
<td><div><?php echo $custname[1];?></div></td>
<td><div><?php echo $hscinvoice[1];?></div></td>
<td><div><?php echo $date[1];?></div></td>
<td><div><?php echo $in[1];?></div></td>
<td><div><?php echo $out[1];?></div></td>
<td><div><?php echo $total[1];?></div></td>
</tr>
</table>
</body>
</html>
Thanks again for the help
<html>
<head>
<title>Freon Log Test 1</title>
<?PHP
$custname = array();
$hscinvoice = array();
$date = array();
$in = array();
$out = array();
$total = array();
$file_handle = fopen("FreonLogs/R22/8A52.csv", "r");
while (!feof($file_handle) ) {
$line_of_text = fgetcsv($file_handle, 1024);
$custname[1]=$line_of_text[0];
$hscinvoice[1]=$line_of_text[1];
$date[1]=$line_of_text[2];
$in[1]=$line_of_text[3];
$out[1]=$line_of_text[4];
$total[1]=$line_of_text[5];
print $line_of_text[0] . $line_of_text[1]. $line_of_text[2] . "<BR>";
}
fclose($file_handle);
?>
</head>
<body>
<table border="1" width="60%">
<tr>
<td><div><?php echo $custname[1];?></div></td>
<td><div><?php echo $hscinvoice[1];?></div></td>
<td><div><?php echo $date[1];?></div></td>
<td><div><?php echo $in[1];?></div></td>
<td><div><?php echo $out[1];?></div></td>
<td><div><?php echo $total[1];?></div></td>
</tr>
</table>
</body>
</html>
Thanks again for the help