php 5.4.16中的isset函数无法正常运行

问题描述 投票:0回答:3

在php版本下

PHP 5.2.4 (cli) (built: Oct 16 2007 16:54:49)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

函数isset工作正常,下面是脚本的片段。

<form name="fff" method=post style="font-size:12pt;">

 <tr height="24">
          <td height="24" width="105"> <p align="left" style="margin-left:10;"><b><font face="Arial"><span style="font-size:10pt;"><?php echo $Agent_03; ?></span></font></b></p> </td>
          <td height="24" width="40">
            <p align="center">
              <input type="text" name="CosHour_03" value="<?php echo $AtdH_03; ?>" style="font-weight:normal; font-size:10pt; color:rgb(102,102,102); text-align:center; on" maxlength="2" size="2">
            </p>
          </td>
          <td height="24" width="5"> <p align="center"><b><font face="Arial"><span style="font-size:10pt;">:</span></font></b></p> </td>
          <td height="24" width="40">
            <p align="center">
              <input type="text" name="CosMine_03" value="<?php echo $AtdM_03; ?>" style="font-weight:normal; font-size:10pt; color:rgb(102,102,102); text-align:center; on" maxlength="2" size="2">
            </p>
          </td>
          <td height="24" width="105">
            <p align="right">
              <input type="text" name="Cs_03" value="" style="font-weight:normal; font-size:10pt; color:rgb(102,102,102); on" maxlength="12" size="12">
            </p>
          </td>
          <td height="24" width="185">
            <p align="left"><input type="text" name="CnsCoe_03" value="<?php echo $CleCoe_03; ?>" style="font-weight:normal; font-size:10pt; color:rgb(102,102,102); on" maxlength="24" size="24">
            </p>
          </td>
        </tr>

<p align="center" ;">
        <input type="submit" name="ReportCons_Submit" value="SUBMIT" style="font-family:Arial; font-weight:bold; font-size:14; color:rgb(32,46,125); letter-spacing:4; text-align:center; background-color:rgb(204,204,204); margin-left:0;" size="200">
      </p>

</form>


<?php

if ( isset( $ReportCons_Submit)) {

          $alertmessage   = "";
          $successmessage = "";
          $strCountry     = strtoupper( $Country);
          $strLocation    = strtoupper( $Location);
          $strFixedDate   = date("Ymd", strtotime(date("Y")."-".$CnsMonth."-".$CnsDay));
.
.
.
.
?>

同样的事情在最近的php版本中不起作用。

PHP 5.4.16 (cli) (built: Apr  4 2016 07:13:18)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

如果我们单击Submit按钮,我不会觉得控件进入if语句。

任何有关这方面的帮助将不胜感激。

php forms submit isset
3个回答
0
投票

isset工作,但$ReportCons_Submit不存在。

使用

if (isset($_POST['ReportCons_Submit'])) {...}

'问题'是由PHP 5.4.0中删除的register_globals引起的(在PHP 5.3.0中已弃用)。


0
投票

试试if (isset($_POST['ReportCons_Submit'])){}。它应该工作。


-1
投票

尝试

if(!empty($ReportCons_Submit)){

}

代替

if(isset($ReportCons_Submit)){


}
© www.soinside.com 2019 - 2024. All rights reserved.