Jump to content

Recommended Posts

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 :-/

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.