This is what i have tried
<script type="text/javascript">
function myFunction(input2) {
var input1 = document.getElementById('pinput2');
var input3 = document.getElementById('pinput3');
var paymethod = document.getElementById('pm');
@php
$price = round($rates->get_rate("<script>document.writeln(input2);</script>", $settings->s_currency,"price"), 3 );
@endphp
var c_price = '<?php echo $price; ?>';
var calculated_price = input2.value/c_price;
input1.value = calculated_price;
input3.value = calculated_price;
paymethod.value = input2;
};
function changecoin() {
var crypto = document.getElementById("coinch");
var coin = crypto.value;
if (coin == "BTC") {
myFunction("BTC");
}
if (coin == "ETH"){
myFunction("ETH");
}
if (coin == "LTC"){
myFunction("LTC");
}
}
</script>
and i can not get the input2 to work inside my php code
@php $price = round($rates->get_rate("<script>document.writeln(input2);</script>", $settings->s_currency,"price"), 3 ); @endphp
I am using Laravel to develop an app where the system get the value of BTC to naira as he/she types in the values in real time.