Forum Moderators: coopster

Message Too Old, No Replies

Can a html form POST the same value to 2 arrays?

WorldPay donation problems

         

badlydrawnben

5:26 pm on Jan 5, 2009 (gmt 0)

10+ Year Member



Hi all,

I'm a PHP newbie so this may be a simple question but here goes:

I'm making an online donations page for our charity and the HTML form uses PHP to POST data to WorlddPay (payment processor).

For regular donations (using the FuturePay service) there are 2 variables - amount and normalAmount. This is essentially for how much you want to pay now, and how much you want the regular payments to be. In our case it would be the same - e.g. I want to pay £2 now and £2 every month.

Here's some snippets from our form:

<form action="https://select-test.worldpay.com/wcc/purchase" method=POST>

<input name="normalAmount" type="text" size="3" maxlength="6" />

so this is sending a value for 'normalAmount' through to WorldPay fine.

Is there an easy way of also sending the same value through as the variable 'amount' ?

In very-bad-PHP it would look something like this:

<?php $amount=$_POST['normalAmount']; ?>
<INPUT TYPE=HIDDEN NAME="amount" VALUE="$amount">

Does that make any sense to anyone?

Thanks,

Ben

eelixduppy

5:01 am on Jan 6, 2009 (gmt 0)



Your PHP code is correct but it doesn't make sense to me. What I think you need is some javascript to make whatever they type into the first field the value of the second field. Maybe something like this:

[pre]
<form action="https://select-test.worldpay.com/wcc/purchase" method=POST name="payment">
<input name="normalAmount" type="text" size="3" maxlength="6" onChange="document.payment.amount.value = this.value;" />
<input name="amount" type="hidden" value="" />
</form>
[/pre]

Try something along those lines and see how that does.