我有一个打印出信息行的页面。每行都有一个备注框:
<?php
<td style='font-size:12px;width:300px;'>
{$row['Notes']} <br /><center><br />
<form action=\"http://********/functions/notes.php\" id='formNotesform' method='post'>
<input type='hidden' id='ID' name='ID' value='{$row['ID']}' />
<textarea placeholder=\"Add more notes here...\" name=\"notes\" rows=\"5\" cols=\"30\"'></textarea><br />
<input type='submit' name='formNotes' id='formNotes' value='Add to Notes' />
</form>
</center></td>
?>
然后在每一行的页面上还有另一个按钮。
<form action=\"http://********/functions/archive.php\" method='post' id='formArchiveform' onclick=\"return checkArchive()\">
<input type='hidden' id='ID' name='ID' value='{$row['ID']}' />
<input type='submit' name='formArchive' id='formArchive' value='Archive' style=\"height:25px; width:80px\"/>
</form>
我需要做的是当有人点击&#34;添加到笔记&#34;按钮它完成它的工作,但当有人点击&#34;存档&#34;它检查按钮是否为空,如果不是,那么它也会提交(有点像故障保险)。
理想情况下,我只想拿起Notes数据并将其发布到archived.php文件中,无论如何都会将表单发布到该文件中,因为这会对代码库造成最小的干扰但我无法获得它起作用。
我知道这不是一个明智的选择。它必须要做。谢谢你的帮助!
答案 0 :(得分:0)
如果我有声望,我会首先询问,因为我的理解是你现在想要按下什么按钮再做其他事情。
如果是这样的话:
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
if(isset($_POST['formNotes']))
{
//...
}
elseif(isset($_POST['formArchive']))
{
//...
}
}