<?php
/* Testing database code:
create table products (
id int auto_increment not null,
size varchar(20) null,
price varchar(20) null,
primary key (id)
);
insert into products (size, price) values ('small', '2.33');
insert into products (size, price) values ('medium', '3.23');
insert into products (size, price) values ('large', '4.35');
*/
$query = "select size, price from products";
$result = mysql_query($query);
echo '<select name="size">';
while($row = mysql_fetch_array($result)){
echo '<option value="' . trim($row['size']) . '">' . trim($row['price']) . '</option>';
}
echo '</select>';
?>
|