我现在要实现一个 注册的时候 点击“上一步” 可以返回上一页 修改注册的信息 显示之前注册的信息我是用ASSIGN把SEESION保存的变量置换实现的但返回到下面这个PHP页面 这个页面设计到验证码的处理 会提示 验证码错误 怎样判断是点击“上一步” 而不是 点击“下一步”到这个页面的呢 (点击下一步的时候 我把FORM的ACTION链接设为下面的PHP页面 而“上一步”是通过BUTTON 的ONCLICK实现的 链接也是这个PHP页面)
请各位高手指点
if (isset($_SESSION['code']) && $_POST['txtCode'] == $_SESSION['code'])   //处理验证码错误问题
    {
          $this->m_smarty->set_template_dir('modules/Company/_templates');
    $this->m_smarty->display("Manager.tpl");
         }
         else {
          echo "<script>";
echo "alert('验证码输入有误,请返回重新填写');window.location='http://localhost/UmasoftFrw2/index.php?module=Company&submodule=RegisterInfo&action=RegisterInfo';"; 
// echo "window.location.href='http://localhost/UmasoftFrw2/index.php?module=Company&submodule=RegisterInfo&action=RegisterInfo'" ; 
echo "</script>";
           
         }

解决方案 »

  1.   

    你可以试下把上一步的按钮和下一步的按钮各给一个name值,比如上一步:name=return_button;下一步:name=next_button;然后在点击的时候获取值,到了你要到的页面对这个值进行判断,然后利用判断结果来决定是否要进行验证码判断,呃,你试试看下吧~
      

  2.   

    if ((isset($_SESSION['code']) && $_POST['txtCode'] == $_SESSION['code'])||($_POST['return_button']=="返回上一步"))   //处理验证码错误问题
        {
              $this->m_smarty->set_template_dir('modules/Company/_templates');
        $this->m_smarty->display("Manager.tpl");
             }
             else {
              echo "<script>";
    echo "alert('验证码输入有误,请返回重新填写');window.location='http://localhost/UmasoftFrw2/index.php?module=Company&submodule=RegisterInfo&action=RegisterInfo';"; 
    // echo "window.location.href='http://localhost/UmasoftFrw2/index.php?module=Company&submodule=RegisterInfo&action=RegisterInfo'" ; 
    echo "</script>";
               
             }加了一个 $_POST['return_button']=="返回上一步" 条件 
    'return_button' 所在FORM表单 POST方法 
    <input TYPE="button" name="return_button" VALUE="<{$APP_STRING.APP_BUTTON_BUTTON}>" ONCLICK="location.href='http://localhost/UmasoftFrw2/index.php?module=Company&submodule=RegisterInfo&action=RegisterOne'">
      

  3.   

    还是会提示验证码错误的ALERT 也就是没执行那个判断条件 没取到 $_POST['return_button'] 的值 其中<{$APP_STRING.APP_BUTTON_BUTTON}> 定义为“返回上一步”
      

  4.   

    各位大哥 帮帮忙啊 本来写个新页面也可以的 但感觉很冗余啊 刚才测试了下 没取到$_POST['return_button'] 的值 怎么取到<input TYPE="button" name="return_button" VALUE=" <{$APP_STRING.APP_BUTTON_BUTTON}>" ONCLICK="location.href='http://localhost/UmasoftFrw2/index.php?module=Company&submodule=RegisterInfo&action=RegisterOne'"> 
     
     
    的值呢