【发布时间】:2015-03-25 06:19:18
【问题描述】:
在我的 HTML 表格中,我为每一行创建了一个按钮链接。我需要编辑现有行并添加新行。链接工作正常,但我需要将参数传递给 url 。例如,如果我需要添加新行,我需要获取数据单元格的值,例如
echo "<form action=insert_rows.php?machine_ip&crawler_type&keywords&instances_no method=get>";
它转到正确的链接,但我无法获取行数据,它没有通过,与现有行相同,通过提交按钮我可以提交到链接,但我无法传递行值。对于现有的行,我需要传递各自的主键,然后访问这些行。
到目前为止我的代码
<style>
input{
width: 100%
}
</style>
<?php
include('db_connect.php');
$conn = db_connect();
mysql_select_db("crawler_status");
$query="Select * from crawler_info";
$result=mysql_query($query);
echo "<table style=width:1000px border=2>";
echo "<tr>";
echo "<td>"."<b>"."Machine IP"."<b>"."</td>";
echo "<td>"."<b>"."Crawler Type"."</b>"."</td>";
echo "<td>"."<b>"."Keywords"."</b>"."</td>";
echo "<td>"."<b>"."No Of Instances"."</b>"."</td>";
echo "<td>"."<b>"."No Of Keywords"."</b>"."</td>";
echo "<td>"."<b>"."Running Status"."</b>"."</td>";
echo "</tr>";
while($row=mysql_fetch_array($result)){
echo "<tr>";
echo "<form action=individual_rows.php method=get>";
echo"<td>". $row['machine_ip']."</td>";
echo "<td>". $row['crawler_type']."</td>";
echo "<td>". $row['keywords']."</td>";
echo "<td>". $row['no_of_instances']."</td>";
echo "<td>". $row['no_of_keywords']."</td>";
echo "<td>". $row['running_status']."</td>";
echo "<td>"."<input type=submit value =EDIT></td>";
echo "</form>";
echo "</tr>";
}
echo "<tr>";
echo "<form action=insert_rows.php?machine_ip&crawler_type&keywords&instances_no method=get>";
echo "<td>"."<input type=text name=machine_ip form=my_form></td>";
echo "<td>"."<input type=text name=crawler_type form=my_form ></td>";
echo "<td>"."<input type=text name=keywords form=my_form></td>";
echo "<td>"."<input type=text name= =instances_no></td>";
echo "<td>"."<input type=text name=keywords_no></td>";
echo "<td>"."<input type=submit value =submit></td>";
echo "</form>";
echo "</tr>";
echo "</table>";
?>
我应该如何进行?
【问题讨论】: