Jump to content

Stinky form >:(


Perfidus

Recommended Posts

I've been trying to find out what the hell is going on with this form, but I can't figure it out.

It should take the values of a number of fields and after calculate a 5% increment.

For the firts value it does it OK but for the following it brings a different result ( the same for all the rest but definitively not the +5%)

 

The code for the form:

 


      <input name="desc[]" type="text" value="WHATEVER ARTICLE" size="100"> 
      <input name="precio[]" type="text" id="precio5" value="25.00">
      <input name="incr[]" type="checkbox" id="incr[]" value="98930" />
      <input type="hidden" name="incremento" value="5" ></td>
      <input type="hidden" name="numresult" value="4" ></td>

 

The code for the 5% increment

 


if($incremento != 0 || $incremento != ''){
for($i=0;$i<$numresult;$i++){	
$incrementar = "UPDATE productos SET precio = ($precio[$i] + (($precio[$i] * $incremento) / 100)) WHERE (referencia='$incr[$i]')";
$incremento = mysql_query($incrementar) or die(mysql_errno().'<p>'.$incrementar.'</p>');
  }
}

 

[move]in the first case I get the 26'25 (25 + 5%) but in the following I get 25'25 !!!!! :o[/move]

Link to comment
https://forums.phpfreaks.com/topic/73191-stinky-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.