I'm a complete newb at PHP/MySQL, but have decided to make some sort of interface to deal with my shop's stock. I've learned loads but am now stuck and in despair.
This form displays a group of a certain type of stock and the quantity:
<form method="post" action="submit.php">
<?php
while ($row = mysql_fetch_assoc($rs)) {
echo"<input type=\"hidden\" name=\"ovid[]\" value=" . $row['option_value_id'] . " />";
echo $row['name'];
echo"<input type=\"text\" name=\"quant[]\" value=" . $row['quantity'] . " />";
echo"<input type=\"submit\" /><br />";
} ?>
</form>
And this is the submit.php:
$_POST['ovida'] = implode(",",$_POST['ovid']);
$_POST['quanta'] = implode(",",$_POST['quant']);
print $_POST["ovida"];
print $_POST["quanta"];
$ovidyay = $_POST["ovida"];
$quantyay = $_POST["quanta"];
$query = "UPDATE product_option_value SET quantity ='$quantyay' WHERE option_value_id = '$ovidyay'";
$rs = mysql_query( $query )
or die( mysql_error() );
There's no error when I press submit (there have been many), but the only entry I can update is the first one on the list. Any help would be gratefully accepted.