我有一个包含两个按钮的表单 但当我按下其中一个时,没有任何事情发生 我找不到问题你能不能帮帮我!!
这是我的php
代码:
<?php
session_start();
include 'connection.php';
// in this section, I retrieve data from database and display them on table
// if agree button pressed do the following
if (isset($_POST['agree']))
{
$que="update project set status='submitted' ,projectstatus=1 where projectid=$id ";
$result3=mysql_query($que);
if ($result3)
{
echo(" <script>
alert('The project has been approved');
</script>");
header( "Location:unsubmited.php" );
}
else
{
echo "an error occur can't agree on this project";
}
}
?>
这是表格:
<form action='' method='post'>
<input type='button' name='disagree' value='disagree ' class='styled-button-11'>
<input type='button' name='agree' value='agree' class='styled-button-11'>
</form>
thanx ^^
答案 0 :(得分:2)
更改你的代码,正如andrewsi所说:
<form action='' method='post'>
<input type='submit' name='disagree' value='disagree ' class='styled-button-11'>
<input type='submit' name='agree' value='agree' class='styled-button-11'>
</form>
答案 1 :(得分:1)
我相信这很简单,填写action=''
到页面以回复并设置type='submit'
作为andrewsi建议。