HTML:
<table border="1">
<tr><th>Tech Names:</th><th>Tech IDs:</th><th>Category:</th></tr>
<?php
echo $data;
?>
</table>
PHP:
<?php
$yay = explode("\n", file_get_contents("flsurvtek.txt"));
$data = "";
foreach ($yay as $tek) {
//Get the data from the first line
if (preg_match("|BEGIN_TECH|i", $tek)) {
if (preg_match('/"([^"]+)"/', $tek, $n)) {
$data .= "<tr><td>".$n[1]."</td>";
}
$tek = str_replace(" ", ":::", $tek);
$tekarray = explode(":::", $tek);
if (strstr($tekarray[2],"0") || strstr($tekarray[2], "1")) {
$data .= "<td>".$tekarray[2]."</td>";
}
if (strstr($tekarray[3],"0") || strstr($tekarray[3], "1")) {
$data .= "<td>".$tekarray[3]."</td>";
}
if (strstr($tekarray[4],"0") || strstr($tekarray[4], "1")) {
$data .= "<td>".$tekarray[4]."</td>";
}
if (strstr($tekarray[5],"0") || strstr($tekarray[5], "1")) {
$data .= "<td>".$tekarray[5]."</td>";
}
}
//Get the data from the second line
if (strstr($tek,"CATEGORY")) {
$tek = str_replace(" ", ":::", $tek);
$tekarray = explode(":::", $tek);
$data .= "<td>".$tekarray[12]."</td></tr>";
}
}
?>
I don't really know why I went from preg_match() to strstr(). Anyway, this works fine, if I was to switch the tek file I believe it would still work. I have 2 files uploaded on their, flsurvtek and multitek to test if it works with a custom tek and a regular tek.