PHP filemaker选择按钮的记录列表

时间:2012-06-27 15:40:01

标签: php filemaker

首先,感谢您阅读本文。

我刚刚开始使用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。

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

1 个答案:

答案 0 :(得分: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>';

By:

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

您有引号和连接错误。