PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
psychotomus
Forum Contributor
Posts: 487 Joined: Fri Jul 11, 2003 1:59 am
Post
by psychotomus » Wed Mar 09, 2005 11:07 pm
I need to submit this form. How can I submit it with php?
The script is choosing between 2 options. if the option is a paid subscription. its updates sql tables then should redirect to this form. How do I post to that form?
Code: Select all
<form action="e;https://www.paypal.com/cgi-bin/webscr"e; method="e;post"e;>
<input type="e;hidden"e; name="e;cmd"e; value="e;_xclick"e;>
<input type="e;hidden"e; name="e;business"e; value="e;ads@trugroovez.com"e;>
<input type="e;hidden"e; name="e;item_name"e; value="e;Premier Site Submission"e;>
<input type="e;hidden"e; name="e;item_number"e; value="e;002"e;>
<input type="e;hidden"e; name="e;amount"e; value="e;12.95"e;>
<input type="e;hidden"e; name="e;no_note"e; value="e;1"e;>
<input type="e;hidden"e; name="e;currency_code"e; value="e;GBP"e;>
<input type="e;image"e; src="e;http://www.vfunk.com/images/pay_pal_button.gif"e; name="e;submit"e; alt="e;Make payments with PayPal - it's fast, free and secure!"e;>
</form>
feyd |
infolock
DevNet Resident
Posts: 1708 Joined: Wed Sep 25, 2002 7:47 pm
Post
by infolock » Wed Mar 09, 2005 11:09 pm
by using a simple if $_POST['option'] == 'whatever'{ //do something }
psychotomus
Forum Contributor
Posts: 487 Joined: Fri Jul 11, 2003 1:59 am
Post
by psychotomus » Wed Mar 09, 2005 11:19 pm
dont queit understand. i need to redirect to that paypal page without the user clicking on the button.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Wed Mar 09, 2005 11:27 pm
ghetto way: have Javascript "click" the button on the resultant page.
different way: use
curl to submit the form on behalf of the user, manipulating the resultant page.. although that would likely not work well because it's going to a secure page..
psychotomus
Forum Contributor
Posts: 487 Joined: Fri Jul 11, 2003 1:59 am
Post
by psychotomus » Wed Mar 09, 2005 11:29 pm
how can I make javascrtipt click on the botton?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Wed Mar 09, 2005 11:33 pm
Code: Select all
document.formsї0].elementsї'submit'].click()or similar, I believe.
psychotomus
Forum Contributor
Posts: 487 Joined: Fri Jul 11, 2003 1:59 am
Post
by psychotomus » Wed Mar 09, 2005 11:41 pm
Code: Select all
<form action="e;https://www.paypal.com/cgi-bin/webscr"e; method="e;post"e;>
<input type="e;hidden"e; name="e;cmd"e; value="e;_xclick"e;>
<input type="e;hidden"e; name="e;business"e; value="e;ads@trugroovez.com"e;>
<input type="e;hidden"e; name="e;item_name"e; value="e;Premier Site Submission"e;>
<input type="e;hidden"e; name="e;item_number"e; value="e;002"e;>
<input type="e;hidden"e; name="e;amount"e; value="e;12.95"e;>
<input type="e;hidden"e; name="e;no_note"e; value="e;1"e;>
<input type="e;hidden"e; name="e;currency_code"e; value="e;GBP"e;>
<input type="e;image"e; src="e;http://www.vfunk.com/images/pay_pal_button.gif"e; name="e;submit"e; alt="e;Make payments with PayPal - it's fast, free and secure!"e;>
</form>
<script type="e;javascript"e;>
document.formsї0].elementsї'submit'].click()
</script>
not working. any suggestions?
infolock
DevNet Resident
Posts: 1708 Joined: Wed Sep 25, 2002 7:47 pm
Post
by infolock » Thu Mar 10, 2005 12:11 am
do you have any other forms besides that one on the same page? if so, then you are gonna need to supply the form in question with a NAME and then call the click via it's name in the document javascript call...
psychotomus
Forum Contributor
Posts: 487 Joined: Fri Jul 11, 2003 1:59 am
Post
by psychotomus » Thu Mar 10, 2005 1:18 am
cant get it to work
Code: Select all
<form action="e;https://www.paypal.com/cgi-bin/webscr"e; name="e;tester"e; method="e;post"e;>
<input type="e;hidden"e; name="e;cmd"e; value="e;_xclick"e;>
<input type="e;hidden"e; name="e;business"e; value="e;ads@trugroovez.com"e;>
<input type="e;hidden"e; name="e;item_name"e; value="e;Premier Site Submission"e;>
<input type="e;hidden"e; name="e;item_number"e; value="e;002"e;>
<input type="e;hidden"e; name="e;amount"e; value="e;12.95"e;>
<input type="e;hidden"e; name="e;no_note"e; value="e;1"e;>
<input type="e;hidden"e; name="e;currency_code"e; value="e;GBP"e;>
<input type="e;hidden"e; src="e;http://www.vfunk.com/images/pay_pal_button.gif"e; name="e;submit"e; alt="e;Make payments with PayPal - its fast, free and secure!"e;>
</form>
<SCRIPT LANGUAGE="e;text/JavaScript"e;>
document.tester.submit();
</SCRIPT>
isnt this correct or am I overlooking something simple?
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Thu Mar 10, 2005 7:30 am
Code: Select all
<form id="e;paypalForm"e; action="e;https://www.paypal.com/cgi-bin/webscr"e; name="e;tester"e; method="e;post"e;>
<input type="e;hidden"e; name="e;cmd"e; value="e;_xclick"e;>
<input type="e;hidden"e; name="e;business"e; value="e;ads@trugroovez.com"e;>
<input type="e;hidden"e; name="e;item_name"e; value="e;Premier Site Submission"e;>
<input type="e;hidden"e; name="e;item_number"e; value="e;002"e;>
<input type="e;hidden"e; name="e;amount"e; value="e;12.95"e;>
<input type="e;hidden"e; name="e;no_note"e; value="e;1"e;>
<input type="e;hidden"e; name="e;currency_code"e; value="e;GBP"e;>
<input type="e;hidden"e; src="e;http://www.vfunk.com/images/pay_pal_button.gif"e; name="e;submit"e; alt="e;Make payments with PayPal - its fast, free and secure!"e;>
</form>
<SCRIPT LANGUAGE="e;text/JavaScript"e;>
document.getElementById('paypalForm').submit();
</SCRIPT>
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Mar 10, 2005 8:37 am
d11's will have an error.. as there is an element named 'submit' that will be called before the submit method can be found and called. That's the dilemma. If you change the name of the image button, then it has the potential to work.
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Thu Mar 10, 2005 8:40 am
feyd wrote: d11's will have an error.. as there is an element named 'submit' that will be called before the submit method can be found and called. That's the dilemma. If you change the name of the image button, then it has the potential to work.
My bad... I overlooked that. I just copied/pasted and modified the right bits but missed the submit name. Take it out. I was just trying to get away from the ambiguity as to whether it was forms[0] or not
PrObLeM
Forum Contributor
Posts: 418 Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:
Post
by PrObLeM » Thu Mar 10, 2005 11:06 am
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Thu Mar 10, 2005 12:13 pm
feyd wrote:
different way: use
curl to submit the form on behalf of the user, manipulating the resultant page.. although that would likely not work well because it's going to a secure page..
.....