I have a .csv file which contains the name of a product and its quantity separated by a comma. I would like to choose a product from the ComboBox and have its quantity displayed into 'max' of my input of numer type . Here is a sample of the .csv file :
Xbox,12
Playstation,15
Switch,13
Here is a sample of my HTML and PHP code :
<form class="" method="POST" action="index.php">
<label for="product"> Produit </label>
<select name="product" id="espace">
<option value="">--Please choose a product--</option>
<?php
$file = fopen('prodct.csv', 'r');
if ($file){
while ($ligne = fgets($file))
{
$l = explode(',', $ligne);
echo '<option value="'.$l[0].'">'.$l[0].'</option>';
}
fclose($file);
}
?>
</select>
<br> <label for="quantity"> Quantity </label>
<input type="number" name="quantity" value="" min="0" max=""/>
</form>