is there any way I can get the iterate through a lot of input type number's and only print out the values that have a value greater than 0?
Let's say I have 10
<form action="displayInfo.php" method="post">
<table cellpadding="6">
<tr>
<th>Description</th>
<th>Price</th>
<th>Weight</th>
<th>Image</th>
<th>Quantity</th>
</tr>
<!-- PHP LANGUAGE -->
<?PHP
$sql = "SELECT * FROM parts";
$q = $conn->query($sql) or die("ERROR: " . implode(":", $conn->errorIndo()));
while( $row = $q->fetch(PDO::FETCH_ASSOC))
{
echo '<tr>' .
'<td>' . $row['description'] . '</td>' .
'<td>' . $row['price'] . '</td>' .
'<td>' . $row['weight'] . '</td>' .
'<td> <img src="' . $row[pictureURL] .'" alt="' . $row[number] . '" style="width:50px;height:50px;">' .
'<td> <input type="number" name = "' . $row[number] ." id= "'. $row[number] . '" value="0">' .
'</td>' . '</tr>';
}
echo "</table>";
?>
</table> <br>
<input type="button" id="submit" value="Submit" />
</form>
So they are dynamically created with an id that have values 1,2,3,...10. The values are then updated through user input.
Is there anyway I can catch the data passed by the submit button for the values entered by the user that are greater than 0? If so, how would I also pass the description or even the $row[number] along with the value that is associated with it. the id of the input type number = the $row[number] as displayed in the code.
nameattribute are not even sent to the server.diestatements on SQL failure, this will disrupt user experience and will output dangerous error details to potential hackers.