isset(_POST)无法正常工作

时间:2014-11-23 07:41:05

标签: php html forms

我想链接这两个文件但不能正常工作, 第一个文件到mae选项下拉表单 secon文件打印图像 可以任何机构给出建议?? 谢谢你的帮助

文件选项注册

$spi1s[1]="01_SAT_MAX_DUR";
$spi1s[2]="01_SAT_MAX_INT";
$spi1s[3]="01_SAT_RTN_PRD";
$spi1s[4]="01_SAT_FREQ";
$spires1 = mysql_query("SELECT SPI FROM kekeringan where SPI like '%01_SAT%'");
$spirow1=mysql_fetch_array($spires1);
$spiTitle1=$spirow1["SPI"];
foreach ($spi1s as $spiTitle1) {
    echo "<option id=\"option\" value=\"".$spiTitle1."\" ";
    if (isset($_POST['plot']) && $_POST['plot'] == $spiTitle1) { echo "selected=\"SELECTED\" "; }
            echo ">
            $spiTitle1
    </option>";
    }
echo "<br />";
echo "<br />";echo "</select></td>\n";
echo "<input id='option' type=\"submit\" name=\"getringan\" value=\"Submit\" />\n";
echo "</form>\n";

要打印的文件

if(isset($_POST['getringan'])){
$spi1s[1]="01_SAT_MAX_DUR";
$spi1s[2]="01_SAT_MAX_INT";
$spi1s[3]="01_SAT_RTN_PRD";
$spi1s[4]="01_SAT_FREQ";
$spires1 = mysql_query("SELECT SPI FROM ringan where SPI like '%01_SAT%'");
$spirow1=mysql_fetch_array($spires1);
$spiTitle1=$spirow1["SPI"];

    $image = "<div id=\"plot_res\" style='border:    none;width:810px;height:610px;margin:auto;padding:auto;'>";

    if ($_POST['plot'] == "01_SAT_MAX") {
            $image .= "<center><img src=\"../data/4_0_0.png\" /></center>";
            $image .= "</div>";
            echo $image;
    } elseif ($_POST['plot'] == "SPI_01_SAT_MAX_INT"){
            $image .= "<center><img src=\"../data/4_1_0.png\" /></center>";
            $image .= "</div>";
            echo $image;
    } elseif ($_POST['plot'] == "SPI_01_SAT_RTN_PRD"){
            $image .= "<center><img src=\"../data/4_2_0.png\" /></center>";
            $image .= "</div>";
            echo $image;
    } elseif ($_POST['plot'] == "SPI_01_SAT_FREQ"){
            $image .= "<center><img src=\"../data/4_3_0.png\" /></center>";
            $image .= "</div>";
            echo $image;

    } else {echo "fail";}

1 个答案:

答案 0 :(得分:0)

试试这个

if (array_key_exists('getringan', $_POST)) {
    ...
}

或者如果它也可以

if (array_key_exists('getringan', $_REQUEST)) {
    ...
}