hi i am trying to pass the result of adding two number fields together into the database.
i successfully did this into the email and the thankyou page but i cant get it written to the database.
here is the code i put in the onsubmit before email.
i am no expert at this stuff so i hope i am close anyway :-)
MM<br><br>Post edited by: GreyHead, at: 2008/02/17 15:24
i successfully did this into the email and the thankyou page but i cant get it written to the database.
here is the code i put in the onsubmit before email.
<?php
$totalhrs= $_POST['Prog1_Hours']+$_POST['Prog2_Hours']+$_POST['Prog3_Hours']+$_POST['Prog4_Hours']+$_POST['Prog5_Hours'] ;
?>
<input type="hidden" name="Total_Homeo_Hours" value="<?php echo $totalhrs; ?>">
it returns a 0 result...
i am no expert at this stuff so i hope i am close anyway :-)
MM<br><br>Post edited by: GreyHead, at: 2008/02/17 15:24
Hi MM,
Do you have a database field for 'total hours' - I guess that you do and it's called 'Total_Homeo_Hours' and the value is set to $_POST['Total_Homeo_Hours'].
To write the value you need
Bob
Do you have a database field for 'total hours' - I guess that you do and it's called 'Total_Homeo_Hours' and the value is set to $_POST['Total_Homeo_Hours'].
To write the value you need
<?php
$_POST['Total_Homeo_Hours'] = $_POST['Prog1_Hours'] + $_POST['Prog2_Hours']+ $_POST['Prog3_Hours'] + $_POST['Prog4_Hours'] + $_POST['Prog5_Hours'];
?>
As the form input is hidden you can probably leave the value as value="".
Bob
This topic is locked and no more replies can be posted.