By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,599 Members | 1,872 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,599 IT Pros & Developers. It's quick & easy.

Form Input Value to change a later value

P: n/a
Hi there,
The title probably doesn't really make sense, but here's the explanation:

I'm using paypal to take credit card payments on my web site. Now I have a
field labeled "Quantity"

<input name="Quantity" type="text" size="5">

and I would like the number that the user types into this field to be echoed
to

<input type="hidden" name="add" value="USERSVALUE">

I'm really green when it comes to Javascript, but I am pretty fluent in PHP
:-s. I don't think I can do it in PHP because PHP would be able to change
the value on the same page without something being submitted (am I wrong
here?).

Thanks in advance!
Dimitri Marshall
www.toquewear.com
Oct 1 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Christa Lee said the following on 10/1/2005 1:12 AM:
Hi there,
The title probably doesn't really make sense, but here's the explanation:

I'm using paypal to take credit card payments on my web site. Now I have a
field labeled "Quantity"

<input name="Quantity" type="text" size="5" >
onchange="document.forms['formName'].elements['add'].value=this.value;"

Or, have an onsubmit handler that before the form gets submitted, you
set the hidden field.

But, is this the Paypal form or a form of your own?

If it is a form of your own, then you can simply have PHP duplicate it
on the server after submission.

and I would like the number that the user types into this field to be echoed
to

<input type="hidden" name="add" value="USERSVALUE">

I'm really green when it comes to Javascript, but I am pretty fluent in PHP
:-s. I don't think I can do it in PHP because PHP would be able to change
the value on the same page without something being submitted (am I wrong
here?).


I think you meant "PHP wouldn't be able to" instead, and the answer then
is no.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 1 '05 #2

P: n/a
Lee
Christa Lee said:

Hi there,
The title probably doesn't really make sense, but here's the explanation:

I'm using paypal to take credit card payments on my web site. Now I have a
field labeled "Quantity"

<input name="Quantity" type="text" size="5">

and I would like the number that the user types into this field to be echoed
to

<input type="hidden" name="add" value="USERSVALUE">

I'm really green when it comes to Javascript, but I am pretty fluent in PHP
:-s. I don't think I can do it in PHP because PHP would be able to change
the value on the same page without something being submitted (am I wrong
here?).


Is there a really good reason why you need the same value to be submitted as
"Quantity" and as "USERSVALUE"? What happens is a customer doesn't have
Javascript enabled?

Oct 1 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.