Jump to content

check what was inputed without reloading


zang8027

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="[email protected]" />
<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.

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.