douleng3463 2014-03-22 22:03
浏览 53

PHP,MYSQL和HTML FORMS不能一起工作

I have this code but when I press the submit button No data is being transferred via Get, with the exemption on the submit.

<table cellspacing="0px">
    <tr>
    <td>Name</td><td>Today - <?php echo $date;?></td>
    </tr>
    <form method="get" action="update_reg.php">
    <?php
    $result = mysqli_query($con,"SELECT * FROM TABLE WHERE GROUP = 'Penguins' ORDER BY Rank, Name ");
    while($row = mysqli_fetch_array($result))
      {
      echo "<tr>";
      echo "<td>";
      if($row['Rank'] == "a"){
        $rank = "TOP ";
      }
      if($row['Rank'] == "b"){
        $rank = "MIDDLE ";
      }
      if($row['Rank'] == "c"){
        $rank = "SECOND ";
      }
      if($row['Rank'] == "d"){
        $rank = "BOTTOM ";
      }
      if($row['Rank'] == "e"){
        $rank = "";
      }
      echo $rank . $row['Name'] . "</td>";
      $num = $num + 1;
      echo "<td><input type=\"text\" class=\"today\" id=\"" . $row['id'] . "\" data-number=\"" . $num . "\" size=\"1\" maxlength=\"1\"></td></tr>";
      }
    ?>
</table>
<input type="submit" value="submit">
</form>

For some reason this isn't working, anyone got any ideas why? Thanks in advance.

  • 写回答

3条回答

  • dsa45132 2014-03-22 22:05
    关注

    GROUP is a reserved keyword. So you need to backtick it as

    `GROUP`
    
    
    SELECT * FROM TABLE WHERE `GROUP` = 'Penguins' ORDER BY Rank, Name 
    

    UPDATE FROM LAST COMMENT

    Input need a name which is not there and if you give same name for all of them they will not work. So give a name="something[]" and on submit get the data as array

    评论

报告相同问题?

悬赏问题

  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条