Hi,
I have the following PHP…
[code=php]
<tr>
<td><strong>Year : </strong></td>
<td><select name=”year”> <?
require_once (‘../xector.php’); // Connect to the database
$query = “SELECT id, year FROM year ORDER BY id”;
$result = mysql_query ($query); // Run the Query
while ($row = mysql_fetch_array($result)) {
echo ‘<option value=”‘ . $row[‘year’] . ‘”>’ . $row[‘year’] . ‘</option>’;
}
?> </select></td>
</tr>
Now, I was wondering if there is a small IF statement I could perhaps place in the <option value… part. Basically saying if $row[‘year’] = $current_year then add ‘selected’ ?
Is there an easy way to do this? Of course, I’d define $current_year with date(‘Y’);
Manythanks