I want to use JavaScript to get values from input and embed the output inside a link inside a PHP script. I new to this JavaScript I have tried a lot of options but it ain't working. can someone help me.
<html>
<body>
<form>
<select name="currency">
<option value="btc">BTC</option>
<option value="eth">ETH</option>
</select>
<select name="currency2">
<option value="btc">BTC</option>
<option value="eth">ETH</option>
</select>
</form>
</body>
</html>
<?php
function getPrice($url){
$decode = file_get_contents($url);
return json_decode($decode, true);
}
$btcUSD = getPrice('https://coinlib.io/api/v1/coin?key=659b81f02b22b218&pref=BTC&symbol=BTC');
$btcPrice = $btcUSD["price"];
$btcDisplay = $btcPrice;
?>
question from:
https://stackoverflow.com/questions/66065332/i-want-to-use-javascript-to-get-values-from-input-and-embed-the-output-inside-a 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…