barrowvian Posted June 9, 2010 Share Posted June 9, 2010 I have this code so far; <form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="me@mybiz.com"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="item_name" value="product"> <input type="hidden" name="amount" value="10.00"> <input type="hidden" NAME="return" value="http://www.mybiz.com/success"> <table> <tr><td><input type="hidden" name="on1" value="Firstname" maxlength="50">Firstname:</td><td><input type="text" name="os1"></td></tr> <tr><td><input type="hidden" name="on2" value="Surname" maxlength="50">Surname:</td><td><input type="text" name="os2"></td></tr> <tr><td><input type="hidden" name="on3" value="Email" maxlength="200">Email:</td><td><input type="text" name="os3"></td></tr> <tr><td><input type="hidden" name="on4" value="Contact Number" maxlength="50">Contact Number:</td><td><input type="text" name="os4"></td></tr> <tr><td><input type="hidden" name="on5" value="Company Name" maxlength="50">Company Name:</td><td><input type="text" name="os5"></td></tr> <tr><td><input type="hidden" name="on6" value="Company URL" maxlength="200">Company URL:</td><td><input type="text" name="os6"></td></tr> <tr><td><input type="hidden" name="on7" value="Keywords" maxlength="200">Keywords:</td><td><input type="text" name="os7"></td></tr> <tr><td>Quantity:</td><td><input type="text" name="quantity" value="1" size="5" /></td></tr> </table> <input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"> </form> I am also wanting the user to be able to upload an image. Is there any certain way that I'd need to add validation to this paypal form to ensure that the information entered is accurate? I also want to store the image file in a folder too (I can do that) but I just need some starters for the validation, thanks Quote Link to comment https://forums.phpfreaks.com/topic/204281-adding-validation-to-a-paypal-button/ Share on other sites More sharing options...
JonnoTheDev Posted June 9, 2010 Share Posted June 9, 2010 As the form is submitted to paypal with <form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post"> you should take the data you require in a step prior to the currenct form. Here you can also add your image upload. Once you have validated the data, then redirect the user to paypal. 1. Complete form with required fields & process image upload 2. Validate form 3. If OK send required data to paypal and redirect user You can do the last bit with some hidden fields containing your data and just a continue button or something. Quote Link to comment https://forums.phpfreaks.com/topic/204281-adding-validation-to-a-paypal-button/#findComment-1069941 Share on other sites More sharing options...
barrowvian Posted June 9, 2010 Author Share Posted June 9, 2010 That sounds fairly straight forward. Just to clarify, your'e recommending using two buttons? 1 to do the validation and 1 to 'continue' which would be the button that takes the user to paypal? Quote Link to comment https://forums.phpfreaks.com/topic/204281-adding-validation-to-a-paypal-button/#findComment-1069965 Share on other sites More sharing options...
JonnoTheDev Posted June 9, 2010 Share Posted June 9, 2010 Yep, or you could simply auto submit the second form with an onLoad event i.e <body onLoad="this.form.submit()"> and the user will jump straight to paypal. Quote Link to comment https://forums.phpfreaks.com/topic/204281-adding-validation-to-a-paypal-button/#findComment-1069967 Share on other sites More sharing options...
barrowvian Posted June 9, 2010 Author Share Posted June 9, 2010 I'm a bit stuck at the moment, and I've not used the body onload function before. What Ive decided upon is... do the initial form with validation and then pass that data to the second form. The second form simply displays what the user has entered (and cannot edit it at this point). This gives the user the chance to confirm the details that theyre going to submit. If they click confirm then it does the image upload and directs the user to paypal with all of the details, if they want to edit it they can press back and go start again. How would I implement the data from the first form into the second? With sessions or will the post still field still work? Also, how would I go about adding the upload function to the paypal button? thanks Quote Link to comment https://forums.phpfreaks.com/topic/204281-adding-validation-to-a-paypal-button/#findComment-1070060 Share on other sites More sharing options...
JonnoTheDev Posted June 9, 2010 Share Posted June 9, 2010 How would I implement the data from the first form into the second? With sessions or will the post still field still work? Store in session variables and the pass into the second form as hidden fields. How would I implement the data from the first form into the second? With sessions or will the post still field still work? The image upload is part of your first form, the second posts to paypal, not to your own server. Quote Link to comment https://forums.phpfreaks.com/topic/204281-adding-validation-to-a-paypal-button/#findComment-1070100 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.