[英]How i can retrieve a variable value from other file in php
I am getting var from 1 file to other but its reporting error as undefined var. 我正在从1个文件到另一个文件获取var,但其报告错误为未定义的var。
I used form to retrieve, using POST method what can i do to get var value. 我使用POST方法检索表单,该如何获取var值。
Form(It has $email & $str value). 表格(具有$ email和$ str值)。
<form action="resetpassword.php" method="POST">
<input type="hidden" name="email" value="<?php $email; ?>">
<input type="hidden" name="token" value="<?php $str; ?>">
</form>
Callinginotherfile 调用其他文件
<?php
$email = $_POST["email"];
$token = $_POST["token"];
?>
Please replace your code with below code. 请用以下代码替换您的代码。
<?php
$email = (isset($_POST["email"]) ? $_POST["email"] : "");
$token = (isset($_POST["token"]) ? $_POST["token"] : "");
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.