如何执行像“index.php?go = ....”这样的php文件

时间:2012-08-15 10:00:31

标签: php forms

对于我的html文件,我在index.php中有这个:

 <?php
      $go = $_GET['go'];

      if(!empty($go)) {

        if(is_file("page/$go.html")) include "page/$go.html";

        else echo "<br />Page doesn't exist yet, we're working on it :-(";
      }

      else include "page/start.html";

    ?>

我现在想要包含与表单相同的php文件。 我正在呼唤一个表格:

<form name='add_position' method="post" action="page/pr_edit.php" >

然后整个表单通过验证在pr_edit文件中:

if (isset($_POST['add_position'])) {}

目前表单在新窗口中打开,我需要将其作为其余的html文件包含在我的主div中。

这样做的正确方法是什么?我应该将名称更改为pr_edit.html吗?它给了我想要的效果,但我不确定这是正确的方法,因为所有验证都是这个文件?

0 个答案:

没有答案