470,647 Members | 1,056 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

Form Input Value to change a later value

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
2 1489
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
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.

Similar topics

2 posts views Thread by iwasinnihon | last post: by
3 posts views Thread by dave | last post: by
7 posts views Thread by Old Lady | last post: by
6 posts views Thread by Kevin Ingram | last post: by
10 posts views Thread by Steve Benson | last post: by
6 posts views Thread by drec | last post: by
4 posts views Thread by Greg Scharlemann | last post: by
7 posts views Thread by pooba53 | last post: by
1 post views Thread by Korara | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.