<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="style.css">
<title> </title>
</head>
<body>
<center><h1> Генериране на < select > меню </h1></center>
<form action='generate.php' method='post'>
<table cellpadding=3>
<tr>
<td>От:</td> <td> <select name='from_year'>
<?php for($year=
date('Y');
$year>=
0;
$year--
){ ?>
<option value=
'<?php echo $year; ?>' >
<?php echo $year;
?> </option>
<?php } ?>
</select> </td>
</tr>
<tr>
<td>До:</td> <td> <select name='to_year'>
<?php for($year=
date('Y');
$year>=
0;
$year--
){ ?>
<option value=
'<?php echo $year; ?>' >
<?php echo $year;
?> </option>
<?php } ?>
</select> </td>
</tr>
</table>
<input type='submit' name='submit' value='Генерирай!' />
</form>
<?php
if (isset($_POST['submit'])){
$from_year=$_POST['from_year'];
$to_year=$_POST['to_year'];
if ($from_year ==
$to_year){echo 'Моля въведете различни години!';
}
else if ($from_year > $to_year){
?>
Code:<br/>
<!--Изкарване на кода-->
<xmp>
<select name=''>
<?php
echo '<?php for ($year='.
$from_year.
';$year>='.
$to_year.
';$year--){ ?>';
?>
<option value=
'<?php echo '<?php echo $year ?>'; ?>' >
<?php echo '<?php echo $year; ?>';
?> </option>
<?php echo '<?php } ?>';
?>
</select>
</xmp>
<!--КРАЙ на изкарването на кода-->
<?php } else{?>
Code:<br/>
<!--Изкарване на кода-->
<xmp>
<select name=''>
<?php
echo '<?php for ($year='.
$from_year.
';$year<='.
$to_year.
';$year++){ ?>';
?>
<option value=
'<?php echo '<?php echo $year ?>'; ?>' >
<?php echo '<?php echo $year; ?>';
?> </option>
<?php echo '<?php } ?>';
?>
</select>
</xmp>
<!--КРАЙ на изкарването на кода-->
</select>
<?php
}
}
?>
</body>
</html>