Well, if the year was 2012, if the value was selected, is it possible to do it?
$ano[] = "<option value='$row[ano]'/>"
Well, if the year was 2012, if the value was selected, is it possible to do it?
$ano[] = "<option value='$row[ano]'/>"
To capture the current year, use
$anoAtual = date('Y');
To do what you want, you can use the PHP conditions
<?php
$anoAtual = date('Y');
if ($anoAtual == $row['ano']) {
$ano[] = "<option value='{$row['ano']}' selected>";
} else {
$ano[] = "<option value='{$row['ano']}'>";
}
Or so
<?php
if ($row['ano'] == '2012') {
$ano[] = "<option value='{$row['ano']}' selected>";
} else {
$ano[] = "<option value='{$row['ano']}'>";
}
There are many other ways, but this has to be evaluated according to your needs. Your question was not very clear.
I hope I have contributed.
Here is the solution. If the year is 2012 the option is selected. Now you have to ensure that the year is 2012 only once.
$ano[] = "<option ".($row[ano]=='2012'?'selected':'')." value='$row[ano]'/>"