Reputation: 1065
I'm working on integrating external code. Following is the code:
if(count($_POST))
pay_page(array('key'=>'gtKFFx','txnid'=>'shanil','amount'=>'100');
There are static values. I want to assign php variables to this array:
if(count($_POST))
pay_page(array('key'=>'gtKFFx','txnid'=><?php echo $b; ?>,'amount'=>'10');
How do I achieve that? Can somebody help?
Upvotes: 0
Views: 96
Reputation: 1075
if(count($_POST))
pay_page(array('key'=>'gtKFFx','txnid'=> $b,'amount'=>'10'));
This should work.
Upvotes: 1
Reputation: 3424
If you are in out of php script i.e your code is correct.
Now you are in php script only. so echo is not required.
so just use like below code:
if(count($_POST))
pay_page(array('key' => 'gtKFFx', 'txnid' => $b, 'amount' => 10));
I think this is useful.
Upvotes: 0
Reputation: 27072
Just write there $b
, no <?php
etc. You are in PHP script, so there is no reason why to begin PHP script again.
if(count($_POST))
pay_page(array('key' => 'gtKFFx', 'txnid' => $b, 'amount' => 10));
Note:
- There was missing bracket at the end of the script
- amount is number, so it should be written without quotes.
Upvotes: 1