I have an html form for opening an account on my website, where the user enters username and password etc. There's a button for him to click to register. I also have a Paypal subscription, and can copy the code for that for the user to create a subscription. I understand both those two things.
But there's more to the logic than this. All the data in the form should be validated before the user should be able to pay. Validation happens when he clicks "Register". So either the Paypal buttons should be on the same page as the form, and be disabled at the outset, and enabled once he registers, or they should be on a separate page. So once the data is validated the Paypal buttons should be enabled, or the user directed to the other page where they are. Then, once he has paid, the registration should actually take place. This may be easier if the Paypal buttons are on the same page as the form. Both the registration page and the Paypal page (if there is one) should enable the user to return to the main website.
It looks like it will take quite a lot of figuring out. Can anyone save me time and point me to an example of code to show me how to actually do all of this?