I need to make a form like:
ID1 - TITLE1 {input=text}
ID2 - TITLE2 {input=text}
....
I'm gonna make changes some of the inputs not all of them.
And when I submit form, changed rows will be inserted to another table.
I think its an array and for loop thing but I couldnt figure out the code.
Can anyone help me?
Multi INSERT to MySQL database from a multi input form
Moderator: General Moderators
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
Multi INSERT to MySQL database from a multi input form
Dude,
Please be more self explanatory man
but i think
Please be more self explanatory man
but i think
Code: Select all
// input fields of form
<input name="field[]" id="field[]" type="text"/>
<input name="field[]" id="field[]" type="text"/>
// the from processor
foreach ($_POST['field'] as $field){
$field.= $field.','
}
// mysql
$query = "INSERT VALUES($field)";Re: Multi INSERT to MySQL database from a multi input form
Don't use this on a public server. An array can be easily submitted from a different form with malicious SQL that can potentially kill your data.kendall wrote:Code: Select all
// mysql $query = "INSERT VALUES($field)";
<edit>
And yes, being specific about your problem helps.
Check out the manual over at php.net . It's a great resource. Also, download the MySQL manual from http://www.mysql.org , it's invaluable. All your commands are right there.
</edit>