我有一个表单(用户填写文本表格,也上传文件),我正在评估/验证输入。但在那之后,我怎样才能将post变量作为POST参数传递给(如使用提交按钮的表单时)到另一个PHP文件?
我的示例代码是:
echo '<form action="'.htmlspecialchars($_SERVER["PHP_SELF"]).'" method="post" enctype="multipart/form-data">';
echo '<textarea name="identity" rows="5" cols="50"></textarea>';
echo "<input type='file' name='uploaded_file'>";
echo "<input type='submit' value='upload_file_test' name='submit'>";
echo "</form>";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["identity"])) {
$error_identity = "Empty identity, type something in the fields";
$correct_inputs=false;
} else {
$correct_inputs=true;
}
}
if($correct_inputs === TRUE){
pass $_POST["identity"], $_POST["file"] (including temp name, and other data) to index2.php
}
那么在$ correct_inputs为TRUE之后,我怎样才能像使用表格动作那样将它传递给index2.php?