Page 1 of 1

Pass php var as form value

Posted: Wed Nov 18, 2009 9:11 am
by flashpipe
Not sure why this isn't working, but I'm setting a variable in a form:

Code: Select all

<input type="text" name="total_total" id="total_total" size="15" />
and updating it from another field:

Code: Select all

<input type="text" name="num_reception" id="num_reception" size="15" value="0" onchange="document.myform.total_reception.value=75*parseInt(this.value);document.myform.total_total.value=75*parseInt(this.value);" />
and that works fine. However, when I try to pass that value to the next page, I get errors...

This works fine...

Code: Select all

<input type='hidden' name='pg_total_amount' value="50" />
This gives a "You are not authorized to view this page." error:

Code: Select all

<input type='hidden' name='pg_total_amount' value="<?php echo $total_total ?>" />
This gives an error that the value must a number be greater than 0:

Code: Select all

<input type='hidden' name='pg_total_amount' value='total_total' />
Any ideas how to do this??

Thanks!!!

Re: Pass php var as form value

Posted: Wed Nov 18, 2009 9:21 am
by papa
Sounds like you have some validation code on your submit page. Eiter way your $total_total should be $_GET['total_total'] or $_POST['total_total'] depending on what kind of form you have.