I want to add multiple row in a table by a form.
I know how to a make only one data array but in case of all name array, all detail array, all contact array I can't do this.
I also read here and google many article but I failed to make any result.
So please help me to create it?
So my from is:
<form action="" method="POST">
Name: <input type="text" name="name[]" value="">
Detail: <input type="text" name="detail[]" value="">
Address: <input type="text" name="add[]" value="">
<br />
Name: <input type="text" name="name[]" value="">
Detail: <input type="text" name="detail[]" value="">
Address: <input type="text" name="add[]" value="">
<br />
Name: <input type="text" name="name[]" value="">
Detail: <input type="text" name="detail[]" value="">
Address: <input type="text" name="add[]" value="">
<input type="submit" name="submit" id="submit" value="Submit">
And my php for insert at sql
include("../db.php");
global $dbh;
if(isset($_POST['submit'])){
$data = array(); // now how to do all single post array?
$name = mysqli_real_escape_string($_POST['name']);
$detail = mysqli_real_escape_string($_POST['detail']);
$add = mysqli_real_escape_string($_POST['add']);
$result=mysqli_query($dbh,"INSERT INTO varify (id,name,detail,add) VALUES('','$name','$detail','$add')");