My input type has an attributed disabled
but whenever i save the value in php it does say " field_name is required" why i can’t insert when the input is disabled?
<input disabled type="number" name="qty[]" id="qty_1" class="form-control" min="0" placeholder="Quantity" required onclick="getTotal(1)" onkeyup="getTotal(1)">
also how in select?
<select class="form-control select_group product" data-row-id="row_<?php echo $x; ?>" id="product_<?php echo $x; ?>" name="product[]" style="width:100%;" onchange="getProductData(<?php echo $x; ?>)" required>
<option value=""></option>
<?php foreach ($products as $k => $v): ?>
<option value="<?php echo $v['id'] ?>" <?php if($val['product_id'] == $v['id']) { echo "selected='selected'"; } ?>><?php echo $v['name'] ?></option>
<?php endforeach ?>
</select>
3
Answers
you can’t get the value if you submit disabled input. to solve this use readonly instead
try to set attribute to "readonly"
or if you don’t want to, try programmatically,