I am trying to get the array key of every input type that has value.
Please see below my code
<form action="welcome.php" method="post">
<input type="text" name="ptotal_monthly_fee[]" >
<input type="text" name="ptotal_monthly_fee[]" value"1">
<input type="text" name="ptotal_monthly_fee[]" >
<input type="text" name="ptotal_monthly_fee[]" value"2">
<input type="text" name="ptotal_monthly_fee[]" >
<input type="submit">
</form>
This is welcome.php
<?php
$count = array_keys($_POST['ptotal_monthly_fee']);
foreach ($count as $value) {
echo "$value <br>";
}
?>
My Output is: 0 1 2 3 4
I want my output to be: 1 3