I have the following php code and get the api data from whmcs. This code returns the product name value.
<select id="ssl" class="form-control select_plan" style="width:95%">
<option value="--Select--">--Select--</option>
@foreach($products['products']['product'] as $key)
@if($key['gid'] == '10')
<option value="{{$key['name']}}">{{$key['name']}}</option>
@endif
@endforeach
</select>
This code returns the product price value
@foreach($products['products']['product'] as $key)
@if($key['gid'] == '10')
@foreach($key['pricing'] as $value)
@if($key['name']=='Positive SSL Wildcard')
{{$value['annually']}}
@endif
@endforeach
@endif
@endforeach
Here mentioned my response data from whmcs. Please find the data and suggest any solution
Array
(
[pid] => 31
[gid] => 10
[type] => hostingaccount
[name] => Comodo PositiveSSL
[description] =>
Domain Validation
1 Domain
Free additional server licenses
Issued within 2 days
[module] => GGSSLWHMCS
[paytype] => recurring
[pricing] => Array
(
[INR] => Array
(
[prefix] => ₹
[suffix] => INR
[msetupfee] => 0.00
[qsetupfee] => 0.00
[ssetupfee] => 0.00
[asetupfee] => 0.00
[bsetupfee] => 0.00
[tsetupfee] => 0.00
[monthly] => -1.00
[quarterly] => -1.00
[semiannually] => -1.00
[annually] => 100.00
[biennially] => 200.00
[triennially] => -1.00
)
)
[customfields] => Array
(
[customfield] => Array
(
)
)
[configoptions] => Array
(
[configoption] => Array
(
)
)
)
If i select one product name it doesn't display the corresponding price value of the product.Please suggest any solution.
Firstly change
<option value="$key['name']">$key['name']</option>
to
<option value="{{ $key['name'] }}"> {{ $key['name'] }} </option>
use jquery as follows:
$("#ss1 option:selected").val();