I have these files that are made to start a transaction via paypal with a dinamic price based on the user choices.
<script language="javascript">
submitForms = function(){
document.getElementById("paypal2_form").submit();
document.getElementById("paypal_form").submit();
}
</script>
<form class="paypal" action="payments.php" method="post" id="paypal2_form" target="_blank">
<input type="text" name="amount" value=""/>
<input type="button" value="Click Me!" onclick="submitForms()" />
</form>
<form class="paypal" action="payments.php" method="post" id="paypal_form" target="_blank">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="lc" value="UK" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_LG.gif:NonHostedGuest" />
<input type="hidden" name="first_name" value="Customer's First Name" />
<input type="hidden" name="last_name" value="Customer's Last Name" />
<input type="hidden" name="payer_email" value="customer@example.com" />
<input type="hidden" name="item_number" value="123456" / >
</form>
And this is the php.
$host = "localhost";
$user = "root";
$pass = "";
$db_name = "payments";
$paypal_email = 'myemail';
$return_url = 'return page.org';
$cancel_url = 'cancel page.org';
$notify_url = 'notify page.org';
$xd = $_POST['amount'];
$item_name = 'Test Item';
$item_amount = 10;
...
The thing is that $item_aamount, if I put the exact value it will work but if i use the variable with the value that comes from the form it will ask on the paypal window to insert the value.I tought on the html page insert the value on the database and ask for it on this php but i dont know what to put the transaction_id , field i dont know where it comes from.
(On the html page i have a script that submits the 2 forms one with the value other with the paypal things , its a text input because its a test to make the paypal eat the goddam value from the variable).
If there is a better way to do it rather than this im open.Thx in advance
What I have tried:
I already tried to put the value in a database and get the go get the value on the other page