Hello, can anyone help me with the question: I have a looping form:
[...]
for ($ i = 0; $ i <$ _POST ['NUM_IMAGES'], $ i + +) {
/ / Determine alternate row colors
if ($ i% 2 == 0) {
$ Style = "bgcolor = \\" # FFFFFF \\ "";
$ Bottomstyle = "bgcolor = \\" # FFFFFF \\ "";
Else {}
$ Style = "bgcolor = \\" # EFEFEF \\ "";
$ Bottomstyle = "bgcolor = \\" # EFEFEF \\ "";
}
echo ("\\ n <tr> \\ n <td $style width='15%'> Image # '. ($ i + 1)." </ td> \\ n <td $style> <input type =' file 'name =' image []'></ td> \\ n </ tr> ");
echo ("\\ n <tr> \\ n <td $style width='15%'> Image Title: </ td> \\ n <td $style> <input type='text' name='photo_title[]'> </ td> \\ n </ tr> ");
echo ("\\ n <tr> \\ n <td $style valign=\\"top\\"> Photo Description: </ td> \\ n <td $style> <textarea name = 'photo_desc []' cols = '30 ' rows = '6 'wrap =' default '> </ textarea> </ td> \\ n </ tr> ");
echo ("\\ n <tr> \\ n <td $style valign=\\"top\\"> Album Cover </ td> \\ n <td $style> <input type = \\" radio \\ "name = \\" album_cover \\ "value = \\" $ i \\ ">");
}
[...]
In another php file I insert in the database:
[More code ...]
foreach ($ _POST ['photo_title'] as $ value) {
$ Sql ​​= "INSERT INTO photos VALUES (0, '$ value', '$ _POST [photo_desc]', NOW (), '$ image_location', '$ thumb_location', $ _POST [album_id])," [... more code]
But the record is saved duplicate and confused.
Someone could help me? Thanks in advanced!