-1
    //Here i have mentioned one form and gave action in that.I also gave a button submit.Now when I click on the submit button, It the action given in the form is not perfoming.



<form action="submit.php" method="POST">
            <tbody>
                <tr id='addr0' data-id="0" class="hidden">
                <td data-name="loannum">
                  <input type="number" class="form-control" required>
                </td>
                <td data-name="name">
                  <input id="startdate" name="startdate" min="2016-01-01" max="2020-01-01" type="date" class="form-control">
                </td>
                <td data-name="name">
                    <input type="text" name='gname' placeholder='Group Name' class="form-control"  pattern="([A-z\s]){2,}" required/>
                </td>
                <td data-name="desc">
                    <input type="number" placeholder='Batch Number' class="form-control" pattern="[0-9]{9}" required>
                </td>   
            </tr>
        </tbody>
    </table>
</div>
</div>
    <a id="add_row" class="btn btn-primary" style="background:#84ca71;color:#F44336;padding-bottom:24px;">Add Group</a>
//here we mentioned a button and when we click on it the action given in form should be performed
    <button class="btn btn-default" type="submit"  style="background:#cddc39;color:#F44336;padding:5px 30px 25px 20px;">submit</button>
    </form>
Manthan Dave
  • 2,137
  • 2
  • 17
  • 31

2 Answers2

2

If you are really using the button at bottom I also gave a button submit and you also need to add </form> closing form tag.

also note that, this input will return nothing:

<input type="number" class="form-control" required>

Because you are not using name attribute here.

You also need to add name attribute for Batch Number field.

<input type="number" placeholder='Batch Number' class="form-control" pattern="[0-9]{9}" required>

Update:

As per your comments, you are using button and closing form tag, it means, this is pure PHP issue not related to form action.

What you need here:

  • You must need to check either submit.php available on same root or not, or if you have only one file than leave it blank <form action="">

  • In submit.php file you also need to check the post values like print_r($_POST) check what are you getting and add missing name attributes.

  • Most important part is that, don't know are you using isset() or not, how can you check either submit button isset or not with this input: <button class="btn btn-default" type="submit" style="background:#cddc39;color:#F44336;padding:5px 30px 25px 20px;">

devpro
  • 16,184
  • 3
  • 27
  • 38
0

below is the code that is working fine. form.html

<!DOCTYPE html>
<html>
<head>
<title>Popup Timepicker Demo Using AngularJS, Bootstrap</title>

<meta name="viewport" content="width=device-width, initial-scale=1">

<meta charset="UTF-8">
<meta name="description"
    content="Popup Timepicker Demo Using AngularJS, Bootstrap.">

</head>
<body>
 <form action="submit.php" method="POST">
        <tbody>
            <tr id='addr0' data-id="0" class="hidden">
            <td data-name="loannum">
              <input type="number" name="name1" class="form-control" required>
            </td>
            <td data-name="name">
              <input id="startdate" name="startdate" min="2016-01-01" max="2020-01-01" type="date" class="form-control">
            </td>
            <td data-name="name">
                <input type="text" name='gname' placeholder='Group Name' class="form-control"  pattern="([A-z\s]){2,}" required/>
            </td>
            <td data-name="desc">
                <input type="number" name="name2" placeholder='Batch Number' class="form-control" pattern="[0-9]{9}" required>
            </td>   
        </tr>
    </tbody>
</table>
    </div> </div> <a id="add_row" class="btn btn-primary" style="background:#84ca71;color:#F44336;padding-bottom:24px;‌​">Add Group</a> <button class="btn btn-default" type="submit" style="background:#cddc39;color:#F44336;padding:5px 30px 25px 20px;">submit</button> </form>
</body>
</html>

below is the submit.php code which is in the same folder of form.html.

print_r($_POST);
sunil
  • 195
  • 1
  • 3
  • 11