2012-06-27 34 views
1

首先,感谢您阅读本文。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

替换:

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

你有一个报价和级联错误。

+0

谢谢!我替换了以下部分: echo'​​

'; echo' getField('K_Medical')。'”/>'; echo''; echo'
'; 对不起,该帖子的格式很奇怪。希望你能看到这个好。 :-) –