php - Storing a list from form to database as an array
764
I'm trying to load a multi numbers(rows) to a database from a form. Anyone can help with the code?
$n = $_POST['txtname'];
foreach ($a as $value) {
$sql = "INSERT INTO Sheet1 VALUES($value)";
Answer
Solution:
You need to initialise an array with the data before using the foreach loop.
You should use the following format:
Sources: http://www.w3schools.com/sql/sql_insert.asp
http://bbrown.kennesaw.edu/papers/php2.html