Php 如何在按钮中设置值?

Php 如何在按钮中设置值?,php,mysql,Php,Mysql,我有这个密码 <form action='view.php' method='post'> <table> <?php while($row=mysql_fetch_array($check2)) { echo "<tr><td id='td'>",$row['wTitle']," </td><td></td></tr> <tr><td sty

我有这个密码

<form action='view.php' method='post'>

<table>

<?php
while($row=mysql_fetch_array($check2))
{       
    echo "<tr><td id='td'>",$row['wTitle']," </td><td></td></tr>
    <tr><td style='text-align:right;'>",$row['wContent'],"</td><tr><td height='20'> </td><td>    </td></tr>
<tr><td colspan='2'><input type='submit' name='submit' value='edit'/></td></tr>";
}
?>
</table>
</form>


您必须添加一个带有“action=…”的“form”来包围提交按钮


或者只需使用常规链接

使其成为超链接并将id传递到该页面

while($row=mysql\u fetch\u数组($check2)) {
echo“$row['wTitle']”,单击以编辑 “,$row['wContent'],” 编辑”;
}所以这是非常粗糙的,但这是一种你可以做你想做的事情的方法:

<table>
<?php
while($row=mysql_fetch_array($check2)) {
?>
<tr>
  <td><?php echo $row['wTitle']; ?></td>
  <td>Click to edit</td>
</tr>
<tr>
  <td style="text-align:right;"><?php echo $row['wContent']; ?></td>
</tr>
<tr>
  <td colspan="2" height="202">&nbsp;</td>
</tr>
<tr>
  <td colspan="2">
    <form action="view.php" method="post">
      <input type="submit" name="submit" value="edit" />
      <input name="workId" type="hidden" value="<?php echo $row[workId]; ?>" />
    </form>
  </td>
</tr>
<?php } ?>
</table>

单击以编辑

所以像这样?while($row=mysql\u fetch\u array($check2)){echo“点击编辑“,$row['wContent'],”;}lol。你读心术了吗?XD谢谢你。我现在就试试这个^_^是的,我不使用标题。xD和样式已在单独的文件中。:)非常感谢。非常感谢你!