dongtiran7769 2012-10-10 17:39
浏览 121
已采纳

带有$ _GET函数的PHP代码不起作用,没有错误

I have written a simple PHP code:

<?php
    if (isset($_GET['day']) && isset($_GET['date']) && isset($GET['year'])) {
        $day = $_GET['day'];
        $date = $_GET['date'];
        $year = $_GET['year'];
        if (!empty($day) && !empty($date) && !empty($year)) {
            echo 'It is '.$day.' '.$date.' '.$year;
        } else {
            echo 'Fill in all fields.';
        }
    }
?>

<form action="index.php" method="GET">
    Day:<br><input type="text" name="day"><br>
    Date:<br><input type="text" name="date"><br>
    Year:<br><input type="text" name="year"><br><br>
    <input type="submit" value="Submit">
</form>

To me, everything looks OK. No errors after running. But, neither the output. Non of the echos shows up. Form is there and I enter data, but when I click "Submit", it just stays the same. URL of the page changes and I can see entered data there, but no echos on the page. I have checked the code for spelling errors, and I haven't found any. Thanks in advance.

  • 写回答

2条回答 默认 最新

  • dongwen3437 2012-10-10 17:41
    关注

    You forgot an underscore at this:

     if (isset($_GET['day']) && isset($_GET['date']) && isset($GET['year'])) {
    

    at the last get

     if (isset($_GET['day']) && isset($_GET['date']) && isset($_GET['year'])) {
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)