Search code examples
phplaravellaravel-5form-submitsubmit-button

My PHP submit button does not work. How to solve it?


I am using Laravel 5 and I have some forms in one page. All is works except the last one. It is nothing happen, no error. I tried to put alert in the button. The alert showed, but the data won't saved.

<tr>
  <div>
    <form action="{{ url('AddComment') }}" method="POST">
      <div>
      <td>
        <textarea class="form-control edit" id="com_comment2" name="com_comment2" style="width:90%"  placeholder="Type a New Comment.." required=""></textarea>
        <input type="hidden" name="com_leads2" value="{{ $leads[0]->LED_CODE }}">
        <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
        <button id ="af" class="btn btn-round btn-success">Submit</button>
      </td>
    </div>
    </form>
  </div>
</tr>

Solution

  • Thank you for all the answer to helping me. I have tried it all but still nothing happen. But I looked at @JYoThI comment which said 'You can't place the form as a child element of table ,tbody, tr .' then I moved the form tags inside the <td> and the it is work !!

    <td>
      <form action="{{ url('AddComment') }}" method="POST">
        <textarea class="form-control edit" id="com_comment2" name="com_comment2" style="width:90%"  placeholder="Type a New Comment.." required=""></textarea>
        <input type="hidden" name="com_leads2" value="{{ $leads[0]->LED_CODE }}">
        <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
        <button id ="afjk" class="btn btn-round btn-success">Submit</button>
      </form>
    </td>