<body>
<h1>fgetcsv_reg_5.php</h1>
????????<br />
???? <br />
??????????<br />
?????????????<br />
??????????<br /><br />
?include('fgetcsv_reg_5gaibu.php');//??????????????<br />
????????????<br />

<form action = "fgetcsv_reg_5.php" method = "post">
???????? <br />
<select name="f_in">
<option value = "0">?????????</option>
<option value = "1">??????????</option>
<option value = "2">??????????</option>
<option value = "3">??????????</option>
<option value = "4">??????????</option>
<option value = "5">??????????</option>
<option value = "6">??????????</option>
<option value = "9">??????????</option>
<option value = "10">???????????</option>
<option value = "11">???????????</option>
<option value = "12">???????????</option>
<option value = "13">???????????</option>
</select>
<input type="submit" value="??" />
</form>

<form action = "fgetcsv_reg_5.php" method = "post">
<p>
????????<br>
?????
<input name="f_in" type="radio" value="1">????
<input name="f_in" type="radio" value="2">????
<input name="f_in" type="radio" value="3">????
<input name="f_in" type="radio" value="4">????
<input name="f_in" type="radio" value="5">????
<input name="f_in" type="radio" value="6">????<br>
?????
<input name="f_in" type="radio" value="9">????
<input name="f_in" type="radio" value="10">?????
<input name="f_in" type="radio" value="11">?????
<input name="f_in" type="radio" value="12">?????
<input name="f_in" type="radio" value="13">?????
</p>
<p>
<input type="submit" name="Submit" value="??">
</p>
</form>

<?php
//*********?????????? ***************//
$f_in = $_POST['f_in'];
//*********switch????????????***********//
switch($f_in){
case 0;
echo "<h3>????????????</h3>";
break;
case 1;
echo "<h3>???????</h3>";
$city = "1";//?????????$city???
break;
case 2;
echo "<h3>???????</h3>";
$city = "2";
break;
case 3;
echo "<h3>???????</h3>";
$city = "3";
break;
case 4;
echo "<h3>???????</h3>";
$city = "4";
break;
case 5;
echo "<h3>???????</h3>";
$city = "5";
break;
case 6;
echo "<h3>???????</h3>";
$city = "6";
break;

case 9;
echo "<h3>???????</h3>";
$city = "9";
break;
case 10;
echo "<h3>????????</h3>";
$city = "10";
break;
case 11;
echo "<h3>????????</h3>";
$city = "11";
break;
case 12;
echo "<h3>????????</h3>";
$city = "12";
break;
case 13;
echo "<h3>????????</h3>";
$city = "13";
break;
}

//*********?????????????????????****************** //
include('fgetcsv_reg_5gaibu.php');//?????????????

//*********?????????????******************//

$row = 1;
$handle = fopen("fgetcsv_reg_5.txt", "r") or exit('???????????????</body></html>');

echo "<table border=\"1\" cellpadding=\"5\">\n";
echo "<h4>??????????????</h4>\n";
echo "<tr><th>??</th><th>???</th><th>??</th><th>??</th><th>??</th><th>???</th></tr>\n";
echo "</table>\n";

while (($data = fgetcsv_reg($handle)) !== false) {
$_enc_to=mb_internal_encoding();
$_enc_from=mb_detect_order();
$num = count($data);
$row++;

if($data[3] == $city){
echo "?\n";

echo "$data[0] ?\n";
echo "$data[1] \n"; echo "$data[2] <BR />\n";
echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>?$data[3]????</B>\n";
echo "$data[4] ?\n";
echo "$data[5] ??\n";

echo "?<br>\n";
}

}
fclose($handle);
?>

</body>
</html>

?fgetcsv_reg_5gaibu.php???????

<?php
/**
* ????????????????CSV??????????
* @param resource handle
* @param int length
* @param string delimiter
* @param string enclosure
* @return ??????????????????????FALSE??????
*/
function fgetcsv_reg (&$handle, $length = null, $d = ',', $e = '"') {
$d = preg_quote($d);
$e = preg_quote($e);
$_line = "";
while ($eof != true) {
$_line .= (empty($length) ? fgets($handle) : fgets($handle, $length));
$itemcnt = preg_match_all('/'.$e.'/', $_line, $dummy);
if ($itemcnt % 2 == 0) $eof = true;
}
$_csv_line = preg_replace('/(?:\r\n|[\r\n])?$/', $d, trim($_line));
$_csv_pattern = '/('.$e.'[^'.$e.']*(?:'.$e.$e.'[^'.$e.']*)*'.$e.'|[^'.$d.']*)'.$d.'/';
preg_match_all($_csv_pattern, $_csv_line, $_csv_matches);
$_csv_data = $_csv_matches[1];
for($_csv_i=0;$_csv_i<count($_csv_data);$_csv_i++){
$_csv_data[$_csv_i]=preg_replace('/^'.$e.'(.*)'.$e.'$/s','$1',$_csv_data[$_csv_i]);
$_csv_data[$_csv_i]=str_replace($e.$e, $e, $_csv_data[$_csv_i]);
}
return empty($_line) ? false : $_csv_data;
}
?>