简体   繁体   English

用于存储值的变量,取决于单击的按钮

[英]Variable to store values depending upon button clicked

I am trying to integrate PayU Money Payment Gateway to my website I have three buttons. 我正在尝试将PayU Money Payment Gateway集成到我的网站上,我有三个按钮。 Each button holds a different value of amount. 每个按钮具有不同的数量值。 What i exactly want is that if a user clicks button1 then 999 INR must be passed to the payU, on clicking button2 1999 should be passed to payU. 我真正想要的是,如果用户单击button1,则必须将999 INR传递给payU,单击button2时,应该将1999传递给payU。

if($_POST['d1'] == '999'){  $amount = 999;}if($_POST['d1'] == '1999'){$amount = 1999;}

<input name="d1" type="button" class="btn btn-danger book-btn" data-toggle="modal" data-target="#payment" value="999">
<input name="d1" type="button" class="btn btn-danger book-btn" data-toggle="modal" data-target="#payment" value="1999">
<form method="post">
<input type="submit" name="test1" value="99" />
<input type="submit" name="test1" value="999" />
</form>

then ur $_POST['test1'] will be eather 99 or 999. 那么您的$ _POST ['test1']将会是99或999。

u can also use 你也可以使用

<form method="post">
<button type="submit" name="test1" value="99" >99 Cookies ?</button>
<button type="submit" name="test1" value="999" >GIMME 999!</button>
</form>

so u can set a Custom text on the button. 因此您可以在按钮上设置自定义文本。

CAREFULL 小心

if u use only $_POST['test1'] and set an value. 如果您仅使用$ _POST ['test1']并设置一个值。 someone can manipulate the value="99" to maybe 9999999 and then ur PayU will take that value. 有人可以将value="99"为9999999,然后您的PayU会采用该值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM