所以我创建了一个有3个单选按钮的表。我无法理解如何让每个单选按钮执行其命名任务[功能]。这是我的桌子的照片:
有人可以解释或给我一个关于如何为这些单选按钮提供功能的示例。因此,当编辑文本并选择“更新”并单击提交按钮时,它将更新数据库。
以下是此部分的代码:
<!DOCTYPE html PUBLIC>
<?php
$connection = mysql_connect('localhost', 'root', 'root');
//Test Connection
if (!$connection)
{
die ("Could not connct to the database: <br />". mysql_error());
}
//select db
mysql_select_db('Assets');
$sql1= "SELECT gid, gstmnt FROM Goals";
$records1 = mysql_query($sql1);
//Adding functions to submit
//$gstmnt_up = $_POST['gstmnt'];
?>
<html>
<head>
<title>List of GOALS/List of SERVICES</title>
</head>
<body>
<table width='800' border='3' cellpadding='2' cellspacing='2'>
<tr>
<h1>List of Goals</h1>
<th>GID</th>
<th width= '200'>Goal Statement</th>
<!--Sumbit column-->
<th width= '85'>
<form id="EditGoalForm" action="EditGoals.php" method="POST">
<input type="submit" name="submit" value="Submit"/>
</form>
</th>
</tr>
<!--This is a paragraph. It is editable. Try to change this text.</p>-->
<?php
while ($gtable = mysql_fetch_assoc($records1)) {
echo "<tr>";
echo "<td>".$gtable['gid']."</td>";
echo "<td><div id=textarea contenteditable>".$gtable['gstmnt']."</div></td>";
echo "<td>
<input type='radio' name=".$gtable['gid']." value='asis' checked> AS-IS </br>
<input type='radio' name=".$gtable['gid']." id='radio_update".$gtable['gid']." value='update' > Update </br>
<input type='radio' name=".$gtable['gid']." value='delete' > Delete
</td>";
echo "</tr>";
}
echo "<td> </td>";
echo "<td>
<input type= 'text name='addGoal' placeholder='ADD NEW GOAL HERE' size='100'>
</td>";
echo "<td>
<input type='checkbox' name='add' value='checked'> Add Goal
</td>";
?>
</table>