hi guys, i am stucked in a problem, my php generated form isn't getting updated. the code of show.php is below;
[code=php]
while($curr=mys ql_fetch_array( $result2))
{
$a=$curr['curr_name'];
$b=$curr['curr_amount'];
echo "<tr><td class='style4' width='100'>";
echo "<input name='amountold[]' type='hidden' value='" . $b . "'>";
echo strtoupper($a);
echo "<td class='style4' width='100'>";
echo "<input name='amount[]' value='" . $b . "'>";
}
[/code]
the update page code
[code=php]
$amount=$_POST['amount'];
$amountold=$_PO ST['amountold'];
$i=0;
while (list ($key1,$val1) = @each ($amountold))
{
$old1[$i]="$val1";
$i++;
}
$b=0;
while (list ($key2,$val2) = @each ($amount))
{
$m=(float)$val2 ;
$n=(float)$old1[$b];
mysql_query("UP DATE currency SET curr_amount='$m ' WHERE curr_amount='$n ' ");
$b++;
}
[/code]
well i receive the values correctly in the array and i convert every single value to float but its not getting updated, i am sure its a problem with the variable type of float. by the way the field amount in my database mysql is in float. i dont know wtas going on, plz help me out.
[code=php]
while($curr=mys ql_fetch_array( $result2))
{
$a=$curr['curr_name'];
$b=$curr['curr_amount'];
echo "<tr><td class='style4' width='100'>";
echo "<input name='amountold[]' type='hidden' value='" . $b . "'>";
echo strtoupper($a);
echo "<td class='style4' width='100'>";
echo "<input name='amount[]' value='" . $b . "'>";
}
[/code]
the update page code
[code=php]
$amount=$_POST['amount'];
$amountold=$_PO ST['amountold'];
$i=0;
while (list ($key1,$val1) = @each ($amountold))
{
$old1[$i]="$val1";
$i++;
}
$b=0;
while (list ($key2,$val2) = @each ($amount))
{
$m=(float)$val2 ;
$n=(float)$old1[$b];
mysql_query("UP DATE currency SET curr_amount='$m ' WHERE curr_amount='$n ' ");
$b++;
}
[/code]
well i receive the values correctly in the array and i convert every single value to float but its not getting updated, i am sure its a problem with the variable type of float. by the way the field amount in my database mysql is in float. i dont know wtas going on, plz help me out.
Comment