Need to post data to a payment processing website - but need to validate and preprocess first
Apologies if this is a dumb question. I am not an experienced web programmer.
I am trying to integrate an online payment processing site with my own website. I have some example PHP code supplied by the payments processor that I am using as the template/skeleton for my own integration code.
The code I've been sent relies up the required values being held in an HTML table, then passed to the payment processing site using a submit button, e.g.
form name="Form" action="paymentprocessor.net" method="post">
The problem I have is that the example given to me has all of the values "hard-coded". I need to be able to display the form to the user, collect certain information (e.g. amount, invoice number), pre-process that information (e.g. calculate a hash for security purposes), THEN submit it to the processing site.
I could, at a pinch perhaps, do the validation in javascript using an onSubmit function, but the calculation of the hash from the data input has to be in PHP.
I am struggling to find a way in PHP to do the validation and preprocessing before running the form action?
Is there some way I can get the form action to call a function I've written myself then, if the data passes validation, do the preprocessing and SOMEHOW simulate the data being posted from the table to the payment processing site?
In other word, I need from my code to be able to do something that has the same effect as the submit button triggering the form action.
Help?!
3 Answer(s)