下面是我做的一个日历,输入查询的界面:
==================================================
//以下为程序
<html>
<head>
<title>查询日历</title>
</head>
<body>
 <form action="rilichaxun.php" method="post">
  <table width="300" border="0" align="center" cellpadding="2" cellspacing="2">
   <tr>
     <td width="150"><div align="right" >输入要查询的年份(1900年之后):</div></td>
     <td width="10"><input name="year" type="text" value="请输入年份" size="10" maxlength="10"></input></td>
     
   </tr>
   <tr>
     <td width="150"><div align="right" >输入要查询的月份:</div></td>
      <td width="10"><input name="month" type="text" value="请输入月份" size="10" maxlength="10"></input></td>
   </tr>
  </table>
  <p align="center">
  <input type="submit" name="login" value="查询" >
  </input>
  </p>
 </form>
</body>
</html>====================================================================================
我还定义了另一个php文件来获取 year 和 month  但是运行出来它把month的值覆盖到了year上,不过不给month赋值,相当于我只定义了name="year" 的文本框,而且取值部分变成了name="month"文本框的输入。当我把month文本框的 type 改成password 结果可以运行。不过输入的时候月份成了星星...所以问下,是什么问题?phphtml

解决方案 »

  1.   

    不知道你遇到了什么问题?
    print_r($_POST); 看看
      

  2.   

    就是比如说我输入了 年:2004    月:2
    然后单击查询,然后编辑输出 得到的数字,代码是这样的:
    ====================================
    $year=$_post["year"];
    $month=$_post{"month"];
    echo $year;
    echo $month;
    ====================================
    最后输出出来的内容:
    =======
    2
    =======
    就没了,然后我改一下,只输出$month,即把“echo $year;"删除,结果输出的内容:
    ================
    什么都没有,然后我再改一下,只输出$year,即把“echo $month;”删除,加上“ echo $year"
    结果输出的内容:
    ==========
    2
    ==========
    说明一个问题就是,程序执行的时候就直接把以year命名的文本框的内容没有赋值给$year,直接忽略了,
    然后把以month命名的文本款的内容赋值给$year;还有一种情况就是,程序执行的时候先把以year命名的文本框的内容赋值给$year,然后又把以month命名的文本款的内容赋值给$year,而本来的$month没有赋值。
      

  3.   

    我试过了,详细问题在4楼我给解释了下,希望我写的还算清楚...
    只要我把以month命名的文本框的格式改成password,就可以正常运行...
    说明两个text 格式的文本框发生了冲突...
      

  4.   

    echo $_POST['year'].'=='.$_POST['month'];
    我代码运行了一下,输出来的东西没看来有什么问题,年和月都可以显示啊
      

  5.   

    加个id试试?
    <td width="10"><input id="month" name="month" type="text" value="请输入月份" size="10" maxlength="10"></input></td>
    另,
    <input></input>建议改为<input .../>
      

  6.   

    $year=$_POST["year"];
    $month=$_POST["month"];  //$_POST 大写
      

  7.   

    $year=$_POST["year"];
    $month=$_POST{"month"];
    echo $year;
    echo $month;