paypal and Php?
<p>I have two ways to check from user:</p>

<pre><code>1.if user input (Amount field &lt; 5(user credit):
   do update database the remain amount in my database table.
2.if user input(Amount field) &gt; 5(user credit):
  Do paypal transaction with the submit form.



 &lt;form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="payPalForm"&gt;        
    &lt;input type="hidden" name="item_number" value="01 - General Payment to FreelanceSwitch.com"&gt;
    &lt;input name="item_name" type="hidden" id="item_name"  size="45" value="Posting job"&gt;    
    &lt;input type="hidden" name="cmd" value="_xclick"&gt;    
    &lt;input type="hidden" name="no_note" value="1"&gt;    
    &lt;input type="hidden" name="business" value="seller_1265789181_biz@xxx.xxx.xx"&gt;    
    &lt;input type="hidden" name="currency_code" value="USD"&gt;    
    &lt;input type="hidden" name="return" value="http://freelanceswitch.com/payment-complete/"&gt;       
    Paying Page:&lt;input name="amount" type="text" id="amount" size="5"&gt;   
    &lt;input type="submit" name="Submit" value="Pay"&gt;            
    &lt;/form&gt;
</code></pre>

<p>Anybody could tell me how to do with the paypal submit form with the conditions.?</p>

<p>thanks.</p>

<p>Thanks @Donny Kurnia ,now I have tried:</p>

<p>EDIT::</p>

<pre><code>function compare_user_credit($paying_price, $user_credit){

    $db = &amp;JFactory::getDBO();
    $user =&amp; JFactory::getUser();
    $user_id = $user-&gt;get('id');

    if ($paying_price &lt;= $user_credit) {        
        $remain_credit = $user_credit - $paying_price;
        //DO UPDATE:enough credit
        update_user_credit_after_paying($remain_credit,$user_id);
        $action_after_paying = header("Location: index.php?xxxx=5");
     }
    # Case2 direct to paypal with the submit form.
    else if ($paying_price &gt; $user_credit){
       //Need submit form to paypal.
       $action_after_paying = header("Location: index.php=xxxx&amp;paypal=".$_POST["amount"]);
    }
    return $action_after_paying;
}
$output = '&lt;form method="POST" &gt; ';
     $output .='&lt;h1&gt;Credit:'.get_credit().'&lt;/h1&gt;';
     $output .= ' Paying Page &lt;input type="text" name="amount" size=3 max_length=5 /&gt;';
     $output .='&lt;input type="submit" name="pay" value="pay" /&gt;' ;
     echo $output;

if(isset($_POST["pay"])){
    compare_user_credit($_POST["amount"], $user_credit);

}
</code></pre>

<p>HOw Could I do with Paypal in Case 02.(direct to paypal with submit form.)</p>
