Oto kod w ramach ścisłości
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=iso-8859-2" http-equiv="Content-Type" /> </head> <body> <?php include_once( 'mysql_connect.php'); $request = "SELECT DISTINCT nazwa FROM ir09"; $result = $db->query($request); $found = $result->num_rows; $nazwa = array(); while($row = $result->fetch_array()) { $nazwa[] = $row['nazwa']; } ?> <form action='chart.php' method="post" TARGET="chart.php" onSubmit="window.open('','chart.php', 'width=600,height=300')"> <select name="towar"> <?php for($i=0; $i<$found; $i++) { echo '<option>'.$nazwa[$i].'</option>'; } ?> </select> <br /> <br /> <select name="miesiac1"> </select> <?php $request = "SELECT DISTINCT year(data) as rok FROM ir09;"; $result = $db->query($request); $found = $result->num_rows; $rok = array(); while($row = $result->fetch_array()) { $rok[] = $row['rok']; } ?> <select name="rok1"> <?php for($i=0; $i<$found; $i++) { echo '<option>'.$rok[$i].'</option>'; } ?> </select> <br /> <br /> <select name="miesiac2"> </select> <select name="rok2"> <?php for($i=0; $i<$found; $i++) { echo '<option>'.$rok[$i].'</option>'; } ?> </select> <br /> <br /> <br /> <br /> <input type="submit" value="Rysuj"> </form> <br /> <br /> </body> </html>