PHP - isset($ _ POST [' rejectSeed'])未被检测到

时间:2017-03-04 02:57:23

标签: javascript php jquery

不使用此代码。我有一个模态,其中有一个提交按钮,每次我必须单击提交按钮,没有任何操作或什么,所以有任何插入它在数据库中。我在相同的文件中具有相同的功能但具有相同功能的相同代码。所以数据库插入不是问题。

    //REJECTED PROJECT & CHECKING FOR REASON 
if(isset($_POST['rejectSeed'])){
    echo "HUY";
        $query3="UPDATE projects 
        SET project_status = '7', reason = '".$_POST['reasonSeed']."' 
        WHERE id =".$idProj."";      

        retrieveTable($query3);
        header('Location: listprojectsprojectproposal.php');
}

enter image description here

echo "  
<div class='modal fade' id='modalRejectSeed' role='dialog'>
    <div class='modal-dialog modal-lg'>
      <div class='modal-content'>
        <div class='modal-header'>
          <button type='button' class='close' data-dismiss='modal'>&times;</button>
          <h4 class='modal-title'>Reject ".$strings["project"].": ".$projectDetail->pro_name[0]."</h4>
        </div>
        <div class='modal-body'>
          <h5>Please state the reason why Seed Company rejected the project ".$projectDetail->pro_name[0].". (eg. Insufficient)</h5>

            <div class='input-group'>
                <span class='input-group-addon' id='basic-addon1' style='width:500px;'>Reason for Rejection:</span>
                <input type='text' id='reasonSeed' name='reasonSeed' class='form-control' style='width:500px;' placeholder='' aria-describedby='basic-addon1'>
            </div>

        </div>
        <div class='modal-footer'>
            <input type='submit' id='rejectSeed' class='btn btn-primary' name='rejectSeed'>
        </div>
      </div>
    </div>
  </div>

  ";

1 个答案:

答案 0 :(得分:1)

您必须在模型中添加表单标记

<form action="" method="post">
<div class='modal fade' id='modalRejectSeed' role='dialog'>
<div class='modal-dialog modal-lg'>
  <div class='modal-content'>
    <div class='modal-header'>
      <button type='button' class='close' data-dismiss='modal'>&times;</button>
      <h4 class='modal-title'>Reject ".$strings["project"].": ".$projectDetail->pro_name[0]."</h4>
    </div>
    <div class='modal-body'>
      <h5>Please state the reason why Seed Company rejected the project ".$projectDetail->pro_name[0].". (eg. Insufficient)</h5>

        <div class='input-group'>
            <span class='input-group-addon' id='basic-addon1' style='width:500px;'>Reason for Rejection:</span>
            <input type='text' id='reasonSeed' name='reasonSeed' class='form-control' style='width:500px;' placeholder='' aria-describedby='basic-addon1'>
        </div>

    </div>
    <div class='modal-footer'>
        <input type='submit' id='rejectSeed' class='btn btn-primary' name='rejectSeed'>
    </div>
  </div>
</div>
</div>
</form>