1

首先,感谢您阅读本文。

我刚刚开始使用 php,并且正在尝试使用 FileMaker 创建一个网站来显示和输入信息。

我有 php 连接到我的数据库,然后是使用表单的搜索页面,然后它显示记录列表。我想制作一个“按钮”,它将选择一条记录然后显示相关记录。

这就是我的麻烦所在。我不知道如何制作一个可以保存 record_Id 或 key 字段然后显示下一页的表单。

我正在使用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。

任何帮助将不胜感激!如果我没有提供足够的信息,请告诉我。

4

1 回答 1

1

代替 :

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>';

您有引号和连接错误。

于 2012-06-27T15:45:23.280 回答