Thanks that got me the info I needed to split the file up and load pieces into the array. From the array I could then make the form to select the appropriate cards to be displayed.
This is how I loaded the file:
$deck1 = [];
$maincount = 0;
$handle = @fopen("Deck1.dec", "r");
if ($handle) {
while (($buffer = fgets($handle, 4096)) !== false) {
preg_match_all("#mvid:(\d+)\s+qty:(\d+)\s+name:([^:]+):(\w+)#", $buffer, $matches);
$count = count($matches[1]);
for($i = 0; $i < $count; $i++) {
$deck1[$maincount][1] = $matches[1][$i];
$deck1[$maincount][2] = $matches[2][$i];
$deck1[$maincount][3] = rtrim($matches[3][$i], " loc");
$deck1[$maincount][4] = $matches[4][$i];
}
$maincount++;
}
//echo "<pre>".print_r($deck1, true);
if (!feof($handle)) {
echo "Error: unexpected fgets() fail\n";
}
fclose($handle);
}
And this is how I created radio buttons. I needed to remove certain cards globally.
foreach ($deck1 as $index=>$option) {
if ($option[3] != "Plains" && $option[3] != "Forest" && $option[3] != "Mountain" && $option[3] != "Swamp" && $option[3] != "Island"){
if ($option[4] == "SB"){
echo "<i><input type=\"radio\" name='mText7bgo' value=\"{$option[1]}\">{$option[3]}</i><br>";
}
else {
echo "<input type=\"radio\" name='mText7bgo' value=\"{$option[1]}\">{$option[3]}<br>";
}
}
}
I'm sure there's some optimizing that could have been done, but this got the job done. Thanks.