Javascript 如何将包含JS的PHP变量输出到表单值中?
我有一个javascript来生成ETH地址和私钥。我想将私钥的值和地址输出到注册表中的隐藏字段 然而 作为普通PHP,这将输出所需的结果:Javascript 如何将包含JS的PHP变量输出到表单值中?,javascript,php,forms,Javascript,Php,Forms,我有一个javascript来生成ETH地址和私钥。我想将私钥的值和地址输出到注册表中的隐藏字段 然而 作为普通PHP,这将输出所需的结果: $wallet_address = "<script type='text/javascript'>document.writeln(wallet.address);</script>"; echo $wallet_address; 我没有得到地址,我得到javascript源代码行:document.writeln(walle
$wallet_address = "<script type='text/javascript'>document.writeln(wallet.address);</script>";
echo $wallet_address;
我没有得到地址,我得到javascript源代码行:document.writeln(wallet.address)代码>
如何使$wallet\u address的值成为表单字段中的实际地址?您回显脚本,而不是脚本的呈现
做某事,例如:
$wallet_address = '<script type="text/javascript">function writeWallet(){ document.getElementById(user_wallet).value = "yourAdress";} window.onLoad(writeWallet);</script>';
$wallet\u address='function writeWallet(){document.getElementById(user\u wallet.value=“yourAdress”}window.onLoad(writeWallet);
$wallet_address = '<script type="text/javascript">function writeWallet(){ document.getElementById(user_wallet).value = "yourAdress";} window.onLoad(writeWallet);</script>';