#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0

    Validate same page and submit to paypal, two formactions


    Hi, I am implanting Paypal, and on my last page for purchasing, a form has to be fillt in, and as previous to that form there been many sendbuttons I would like to validate with php and if ok submit to paypal with the same paypal button.
    Is that possible?

    This would be the action for paypal sandbox:
    <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
    Would it be possible to have two form actions?
    If form ok, formaction paypal,
    if form not ok, use this form action:
    <?php echo $_SERVER['SCRIPT_NAME'];?>

    Thanks in advance
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,337
    Rep Power
    594
    You can't have 2 form actions directly. However, your description is a bit fuzzy. How are you checking if the form is OK? Javascript? If so you can submit whichever action is appropriate from there. If from a 3rd PHP script then that script can redirect to whichever URL is appropriate.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0
    Originally Posted by gw1500se
    You can't have 2 form actions directly. However, your description is a bit fuzzy. How are you checking if the form is OK? Javascript? If so you can submit whichever action is appropriate from there. If from a 3rd PHP script then that script can redirect to whichever URL is appropriate.
    Thanks,
    Actually I do validate with javascript, however I have php validation in the background.
    And also I want to check that the value in a field is not higher than in my database, so with php and mysql I would check like this
    mysql select;
    if ($row->bond=="tarjeta"){ go to paypal }
    else { errormessage }

    I dont think I can pass vars using post to paypal in a redirection or can I?
    I just didnīt want to use 2 submitbuttons
  6. #4
  7. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2002
    Location
    Seattle, U.S.A.
    Posts
    712
    Rep Power
    12
    I think you'll either need to use cURL or send the data to paypal via GET (obviously as long as you aren't submitting any confidential information), I'm guessing at this point you are just submitting # of products, cost, taxes, shipping etc.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,337
    Rep Power
    594
    You don't need a submit button to post to PayPal or even $_POST. Are you not using the API?
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0
    Originally Posted by gw1500se
    You don't need a submit button to post to PayPal or even $_POST. Are you not using the API?
    Thanks both, no idea of Curl and not fancy to do by get so I found my way some other way

    This is the first time I do paypal, and as its only in english and so much to read, itīs sort of complicated to understand, and I read its safer to use their buttons.
    I have done a button and I have added several inputs to that button even done my own image for button and it works fine, even the ipn works fine so far.
    Is there another way except by post? Have not read about that.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,337
    Rep Power
    594
    I think that violates their ToS. You should read that first.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0
    Originally Posted by gw1500se
    I think that violates their ToS. You should read that first.
    What violates the TOS?
    adding inputs? I only added inputs they accept.
    Not sure where to read, I read much but not all, there are so many places to read, just try to read whats concerns me.
    Last edited by helenp; December 17th, 2012 at 02:28 PM.
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,337
    Rep Power
    594
    Using other than their API to manage transactions. They don't want anyone doing what you are trying to do. I haven't looked at it for a long time but read their Terms of Service or maybe it is call Terms of Use or Terms and Conditions.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0
    Originally Posted by gw1500se
    Using other than their API to manage transactions. They don't want anyone doing what you are trying to do. I haven't looked at it for a long time but read their Terms of Service or maybe it is call Terms of Use or Terms and Conditions.
    Think I have not explained myself, or I does not understand you.
    I have done a paybutton with paypal, then I changed the image, and I added inputs that they do accept on there website.
  20. #11
  21. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    I dont think I can pass vars using post to paypal in a redirection or can I?
    No

    PayPal has a lot of different APIs. Some you can use cURL for, some you can't. I don't think any of the 'free' (no up front monthly fee) APIs allow you to use cURL.

    What violates the TOS?
    I think he was referring to using cURL with one of the APIs that doesn't support it.

    They won't care if you add inputs. They might complain if you change the button image, but probably won't notice or won't care.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Location
    Marbella, Spain
    Posts
    381
    Rep Power
    0
    Originally Posted by E-Oreo
    No

    PayPal has a lot of different APIs. Some you can use cURL for, some you can't. I don't think any of the 'free' (no up front monthly fee) APIs allow you to use cURL.


    I think he was referring to using cURL with one of the APIs that doesn't support it.

    They won't care if you add inputs. They might complain if you change the button image, but probably won't notice or won't care.
    Thanks,
    No, there are no problem in using your own image, as they have the option when you do the button to choose your own one.

IMN logo majestic logo threadwatch logo seochat tools logo