zang8027 Posted May 13, 2009 Share Posted May 13, 2009 using an input box with the name "amount", can i check to see when the user inputs? I want to have an input form, and when the user enters the type, it to be checked, and if it is between 0-1000, send a form to paypal... if its 1001-5000, send a different form to paypal.. etc any ideas? I tried using php and got this so far: //recieve the passed amount $amount = $_GET['amount']; $productName = "Tender Touch Towels"; if($amount > 0) { if($amount <= 1000) { echo ' <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="business" value="john@leaderexcelsolutions.com" /> <input type="hidden" name="upload" value="1" /> <input type="hidden" name="lc" value="US" /> <input type="hidden" name="custom" value="3" /> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="item_name_1" value="$productName" /> <input type="hidden" name="quantity_1" value="$amount" /> <input type="hidden" name="amount_1" value="0.19"> </form> '; } } elseif($amount >=1001) { if($amount <=5000) { //post form to paypal with $amount and 0.18 echo ' <input type="hidden" name="quantity_1" value="$amount" /> <input type="hidden" name="amount_1" value="0.18"> '; } } elseif($amount >=5001) { if($amount <=10000) { //post form to paypal with $amount and 0.17 echo ' <input type="hidden" name="quantity_1" value="$amount" /> <input type="hidden" name="amount_1" value="0.17"> '; } } ?> but php wont work to check what is inputed :-/ Quote Link to comment https://forums.phpfreaks.com/topic/157997-check-what-was-inputed-without-reloading/ Share on other sites More sharing options...
zang8027 Posted May 13, 2009 Author Share Posted May 13, 2009 may be as simple as adding params to the url with ajax like ?amount=1301 and i can use php to capture that Quote Link to comment https://forums.phpfreaks.com/topic/157997-check-what-was-inputed-without-reloading/#findComment-833403 Share on other sites More sharing options...
Ken2k7 Posted May 13, 2009 Share Posted May 13, 2009 I think you can use JavaScript to change the form's action attribute. Add a onsubmit event to the form to check the value and change the action so it goes to the right place. I think that should work. I haven't really tested such thing. AJAX doesn't work cross-domain. Wrong forum. Quote Link to comment https://forums.phpfreaks.com/topic/157997-check-what-was-inputed-without-reloading/#findComment-833409 Share on other sites More sharing options...
zang8027 Posted May 13, 2009 Author Share Posted May 13, 2009 well i need to change the amount attribute.. im not sure on this at all.. any where i can see an example of this? Quote Link to comment https://forums.phpfreaks.com/topic/157997-check-what-was-inputed-without-reloading/#findComment-833474 Share on other sites More sharing options...
Ken2k7 Posted May 13, 2009 Share Posted May 13, 2009 There is no such thing as the amount attribute. What are you talking about? Quote Link to comment https://forums.phpfreaks.com/topic/157997-check-what-was-inputed-without-reloading/#findComment-833481 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.