Jump to content

simple check amount


zang8027

Recommended Posts

I have an input box called "amount". When the user enters the amount, i need to check what that amount is and send it to paypal. I have three if statements that send the proper amount to paypal:

 

<html>
<head></head>
<body>

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    AMOUNT: <input type='text' name='amount'/>
<input type="hidden" name="business" value="[email protected]" />
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="lc" value="US" />
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name_1" value="$productName" />
<?php

//recieve the passed amount
$amount = $_POST['amount'];
$productName = "Tender Touch Towels";


if($amount > 0)
{
if($amount <= 1000)
{
echo '


  				
  				<input type="hidden" name="quantity_1" value="$amount" />
  				<input type="hidden" name="amount_1" value="0.19">
  				
  				
  		';
}
}

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.18">
  		';
}

}

?>
<input type="submit" value="submit" />
  		</form>
</body></html>

 

now without sending this form to a process page and then sending it to paypal, how can i check to see what the user inputed for amount.

Link to comment
https://forums.phpfreaks.com/topic/157993-simple-check-amount/
Share on other sites

PHP is server side scripting which means that all of the data must be POSTED before the script can run against the value. It appears as though you may need a client side script (javascript) in order to do the client side processing you are looking for. Otherwise, this will need to be posted and then validated.

Link to comment
https://forums.phpfreaks.com/topic/157993-simple-check-amount/#findComment-833377
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.