Try the following:
$year = (int)$row['year']; // this comes from a query that is stored in the db ?> <select name="year"><?php for ($x = 1920; $x < date('Y'); $x++) { ?><option value="<?php echo $x . '"'; if ($x == $year) { echo ' selected="selected"';}?>><?php echo $x; ?></option><? }?> </select>
The main problem was that you did not close the value with double quotes, so 'selected="selected" was included. so you got this:
<option value=1990selected="selected">1990</option>
Also, you did not close the PHP tag before <select
source share