I have a little problem with one of my script:
<label><input type="radio" name="tshirt-size" value="giraffe" checked="checked" ><img src="./images/giraffe.png"></label>
<label><input type="radio" name="tshirt-size" value="bear"><img src="./images/bear.png"></label>
<label><input type="radio" name="tshirt-size" value="monkey"><img src="./images/monkey.png"></label>
and the selected code:
<?php
$sql="SELECT distinct size FROM total where left_quantity > 0 order by ID";
echo "<select name='size'>";
echo "<option disabled>SELECT SIZE</option>";
foreach ($dbo->query($sql) as $row){
echo "<option value = $row[size]> $row[size]</option>";
}
echo "</select>";
?>
table database:
CREATE TABLE stocuri_tricouri (
id int(100) NOT NULL,
type varchar(255) NOT NULL,
size varchar(255) NOT NULL,
left_quantity int(100) NOT NULL,
stoc_ramas int(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `stocuri_tricouri` (`id`, `type`, `size`, `initial_quantity`, `left_quantity`) VALUES (1, 'giraffe', 'S', 250, 250), (2, 'giraffe', 'M', 250, 250), (3, 'giraffe', 'L', 250, 250), (4, 'bear', 'S', 250, 250), (5, 'bear', 'M', 150, 0), (6, 'bear', 'L', 250, 250), (7, 'monkey', 'S', 250, 250), (8, 'monkey', 'M', 250, 250), (9, 'monkey', 'L', 250, 250);
I want to select the size for each radio button, not for all, if i delete the distinct
the select will be with all data... and i want date from each input.
with distinct
: size are: S, M, L
without distinct
: S,M,L,S,M,L,S,M,L