06-27-2008, 12:45 AM
|
#3 (permalink)
|
|
The Addict
Join Date: Jan 2008
Location: los angeles
Posts: 255
Thanks: 39
|
Quote:
Originally Posted by delayedinsanity
Assign them to an array, and loop through the array when you add the data to the table.
HTML Code:
<input type="text" name="row_data[]" value="" />
When you use [] in the input fields name value, it adds all data to an array of the same name. Then you could use a foreach or for loop to spin through them and add them to the database however you like.
-m
|
thanks but what if this is my code
HTML Code:
<input type="text" name="row_data[1]" value="" />
<input type="text" name="row_data[2]" value="" />
<input type="text" name="row_data[3]" value="" />
<input type="text" name="row_data[4]" value="" />
<input type="text" name="row_data[5]" value="" />
what kind of php do i use to loop through this and to the db?
would it look liek this? its just a guess
Code:
for($i=0;$i<count($row_data);$i++) {
$query = mysql_query("insert into table values(null,'$_POST['row_data[i]]'");
}
|
|
|