I want to sort the csv file in numeric order using the coloum id
I tried sort_numeric and it would not work maybe I was not using it correctly.
I want to sort this dropdown list, numerically by it value.
<option value="0"> Select your State </option>
<?PHP
//open csv file then display the result in the dropdown list
$file_handle = fopen("file1.csv", "r");
while (!feof($file_handle) ) {
$line_of_text = fgetcsv($file_handle, 1024);
//define coloum needed to be displayed from the csv file.
$index = $line_of_text[0];
$value = $line_of_text[1];
?>
<option value="<?php print $index; ?>"> <?php print $value; ?> </option>
<?php
}
?></select><?php
fclose($file_handle);
?>