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

    评论

报告相同问题?

悬赏问题

  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程