Rohit Mathur
Rohit Mathur

Reputation: 131

Variable to store values depending upon button clicked

I am trying to integrate PayU Money Payment Gateway to my website I have three buttons. 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.

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">

Upvotes: 0

Views: 55

Answers (1)

KikiTheOne
KikiTheOne

Reputation: 523

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

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. someone can manipulate the value="99" to maybe 9999999 and then ur PayU will take that value.

Upvotes: 1

Related Questions