I am trying to insert data from modal after user clicks submit button. But it is not working, I have 2 files index to display modal and PHP file to run connect MySQL and insert data into it. I don't think it recognizes submit action. I also have question how do I insert primary key id into database or does it adds automatically.
HTML submit code:
<button type="submit" action="add.php"class="btn">Finish!</button>
PHP code:
<?php
include 'db.php';
$cName = $_POST['form-name'];
$ser = $_POST['form-s-name'];
$link = $_POST['form-t'];
$info = $_POST['form-des'];
$sql = "INSERT INTO crewlist(id, name,sname,linkname,description)
VALUES ('','".$cName."','".$ser."','".$link."','".$info."')";
mysqli_query($conn,$sql);
if(mysqli_affected_rows($conn) > 0){
echo "<p>Added</p>";