i have a form with a text field that is an array
Code:
<input name="quantity[]" type="text" id="quantity[]" size="4"
maxlength="4" class="smallText" value="<? inputval2($_POST['quantity'],
$row_rsCatDetails['quantity_cmp'])?>"/>
when the form is submitted i want to replace the elements in the array that does not have a value with a "0".
tried this but it does not work:
Code:
$qty = $_POST['quantity'];
$needle = "";
$replace="0";
for($i=0;$i<count($qty);$i++){
if($qty[$key] == $needle){
$qty[$key]=$replace;
}
}