simple calculation, I am stuck :)

bora 11 Jul, 2012
Hi

I added a custom php element at the end of my form just above the submit button with the next php code :



<?php
  $odds  = $form->data['odds'];
  $stake = $form->data['stake'];
  $won   = (($odds*$stake)-$stake);
  echo"<input type=\"hidden\" name=\"won\" value=\"$won\" />";
?>



I just try to send the result of the odds and stake form fields to the database with a hidden input.
Checking the source code at the front website shows me my hidden input between the form tags but the value of this hidden field is allways 0.

please advice...
bora 12 Jul, 2012
I had to add the php code in the onsubmit event it is working now.
This topic is locked and no more replies can be posted.