The <input> tag specifies an input field where the user can enter data. The <input> element is the most important form element. The <input> element can be displayed in several ways, depending on the type attribute. using jquery and mysqli i have created to add and remove multiple input field and upload to database using mysqli insert sql
CREATE TABLE names (
id INT PRIMARY KEY AUTO_INCREMENT,
names VARCHAR(255)
);
Multiple Fields
Document
connect_errno !=0){
die('connection error');
}
if(isset($_POST['btn_submit'])){
// echo "";
// print_r($_POST);
}
$number= count($_POST["name"]);
echo "You have entered ".$number." names
";
if($number>0){
for($i=0;$i<$number;$i++){
if(trim($_POST["name"][$i]!='')){
echo "- ".$_POST["name"][$i]."
";
$names=$_POST["name"][$i];
// saving in database
$name_sql = "INSERT INTO names (names) VALUES ('$names')";
if($connect->query($name_sql)){
// echo "Saved into Database Successfully";
}
else{
die("Category creation failed $connect->error");
}
}
}
}
echo "
Saved to databse SuccesFully 👌
";
$connect->close();
?>
Input fields refer specifically to the text input fields, which are used to obtain data from the users. A basic example of the input field consists of the input element with specified ID and label element connected via this ID with the input.