【问题标题】:No action is perform on button click单击按钮时不执行任何操作
【发布时间】:2014-11-28 17:17:50
【问题描述】:

我正在尝试在 PHP 中制作多个按钮。我是 html 和 PHP 的新手。我无法在代码中看到问题。当我单击按钮时,它没有给出错误但什么也不做。 这是我的一段代码

<html>
 <head></head>
 <body>
  <table> 
   <tbody>
    <tr> 
    </tr>
   </tbody>
  </table>
  <table border="5" cellpadding="0" cellspacing="0" margin-bottom="1px" width="100%" style="color:navy"> 
   <tbody>
    <tr> 
     <td> <b> Teacher's Name </b> </td> 
     <td> <b> Courses </b> </td> 
     <td> <b> Feedback </b> </td> 
    </tr> 
    <!--?php while ($row = mysql_fetch_row($subjects)) {
                $Teacher_Names = mysql_query("SELECT Name FROM teachers where Teacher_ID = $row[1]");
                $Name = mysql_fetch_row($Teacher_Names)?--> 
    <tr> 
     <td> 
      <!--?php  echo $Name[0];?--></td> 
     <td> 
      <!--?php echo $row[0];  ?--> </td> 
     <td> 
      <form method="POST" action="CourseFeedbackForm.php"> 
       <img type="button" src="books.jpg" height="30" width="30" id="<?php $button.$count?>" name="submit" value="<?php $row[1]?>"> 
       <!--?php $count = $count + 1; ?--> 
       <img src="horizontal1.jpg" height="30" style="padding-left:0px"> 
       <img type="button" src="teachers.jpg" height="30" width="30" id="<?php $button.$count?>" name="submit" value="<?php $row[1]?>"> 
       <!--?php $count = $count + 1; ?-->  
      </form></td>  
    </tr> 
    <!--?php } ?--> 
   </tbody>
  </table>    
 </body>
</html>

【问题讨论】:

  • 将其命名为“提交”不会将简单的按钮变成提交按钮...
  • 那该怎么办呢?
  • 一定要学习 HTML 的基础知识,否则这将是一长串问题中的第一个......

标签: php html xampp


【解决方案1】:

我花了一段时间才明白你在那里做什么,但不是我还是什么都不懂。你为什么打电话给&lt;img type="button"&gt;?为了得到一个按钮,你知道,你可以点击它并执行一段代码,使用&lt;button type="submit"&gt;&lt;/button&gt;。你在那里所做的几乎所有事情都是错误的。我不是专家,但我真的看不出您尝试使用&lt;img&gt; 标签创建按钮的原因。

题外话:学习使用&lt;div&gt;&lt;/div&gt;。它比桌子灵活得多,而且桌子陈旧过时。

【讨论】:

  • 好的。我想我应该多花点时间。
猜你喜欢
  • 2021-09-15
  • 1970-01-01
  • 2021-11-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-12-02
  • 1970-01-01
相关资源
最近更新 更多