I want to have a list of sizes, that i can update. So i made a DB row, containg the sizes and amount. Now I should be able to do something like this:
- I want to take the name of the rows and put them into an array.
- doing a mysql query, that updates the sizes. I think I should be able to use some escape tag on mysql query, and put in the "$val" in loop, so it'll write:
mysql_query("UPDATE product set id='$id', product_1='$product_id', W28L30=$W28L30, W29L30=$W29L30,(and so on..) model='$model' WHERE id='1'");
Any help would be great.. : )
<?include_once 'includes/connection.php';
$array1 =array(W28L30,W29L30,W28L31,W28L32,W30L30,W30L32,W31L34,W32L34,W32L36);?>
<form id="form1" name="form1" method="post" action="">
<?foreach( $array1 as $key => $val )
{
$result = mysql_query( "SELECT * FROM jeans where id = '1' " );
while( $record = mysql_fetch_object( $result ) )
{
$val2 = $record->$val;
?>
<p><input type="text" name="amount" id="amount" size="5" value="<?echo "$val2";?>">
<?}echo "$val";
if(isset($_POST['opdater'])){
$id = 1;
$product_id = 1;
$amount = $_POST["amount"];
mysql_query("UPDATE product set id='$id', product_1='$product_id', $val=$val, model='$model' WHERE id='1'");
}
}?>
<p>
<input type="submit" name="opdater" value="opdater" class="text" />
</form>