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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.