首先,感谢您阅读本文。
我刚刚开始使用 php,我正在使用 FileMaker 创建一个网站来显示和输入信息。
我让 php 连接到我的数据库,然后使用表单进行搜索页面,然后它显示记录列表。我想制作一个"按钮",它将选择一条记录然后显示相关记录。
这就是我的麻烦所在。我不知道如何制作一个表单来保存record_Id或键字段,然后显示下一页。
我正在使用foreach
循环在表中显示列表:
$records = $result->getRecords();
echo '<table border="1">';
echo '<tr>';
echo '<th>Company</th>';
echo '<th>Id Num</th>';
echo '<th>Choose</th>';
echo '</tr>';
foreach ($records as $record) {
echo '<tr>';
echo '<td>'.$record->getField('Company').'</td>';
echo '<td>'.$record->getField('K_Medical').'</td>';
echo '<td>
<form action="welcome.php" method="post">
#This is where I think I need the button, but instead it just breaks :(
<input type="hidden" name="med_id[]" value='$record->getField('K_Medical')/>';
<input type="submit" />
</form>';
echo '</form></td>';
echo '</tr>';
}
echo '</table>';
如您所见,我尝试使用隐藏的表单字段来获取记录的关键字段,但页面剂量不起作用。当我尝试在浏览器中查看它时,我收到错误 500。
任何帮助将不胜感激!如果我没有提供足够的信息,请告诉我。
替换 :
echo '<td>
<form action="welcome.php" method="post">
#This is where I think I need the button, but instead it just breaks :(
<input type="hidden" name="med_id[]" value='$record->getField('K_Medical')/>';
<input type="submit" />
</form>';
作者 :
echo '<td>
<form action="welcome.php" method="post">
#This is where I think I need the button, but instead it just breaks :(
<input type="hidden" name="med_id[]" value='.$record->getField('K_Medical').'/>
<input type="submit" />
</form>';
您有引号和串联错误。