Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/455.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何将包含JS的PHP变量输出到表单值中?_Javascript_Php_Forms - Fatal编程技术网

Javascript 如何将包含JS的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

我有一个javascript来生成ETH地址和私钥。我想将私钥的值和地址输出到注册表中的隐藏字段

然而

作为普通PHP,这将输出所需的结果:

$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>';