probably stupid, but...
| From: | Robert Sossomon | Date: | Fri, 12 Nov 2004 20:08:38 +0000 |
| Subject: | probably stupid, but... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-201858@lists.php.net to get a copy of this message | ||
I have a form that sends 20 rows of data into a script, instead of having to write 20 separate add functions, I wrote this piece of code...
$i=1;
while ($i<20)
{
if ($_POST[book_title_$i]' != "")
{
INSERT INTO
curriculum VALUES ('','$_POST[book_title_$i]','$_POST[book_level_$i]','$_POST[level_grades_$i]','$_POST[book_section_$i]','$_POST[chapter_$i]','$_POST[chapter_title_$i]','$_POST[lesson_title_$i]','$_POST[skill_$i]','$_POST[life_skill_$i]','$_POST[success_indicator_$i]','$_POST[ncscos_$i]','$_POST[subject_$i]','$_POST[pages_$i]','$_POST[c_kit_$i]');
$message .= "The entry $i was entered
";
$i++;
}
else
{ $i++; }
}
But I get THIS error in the log:
[12-Nov-2004 14:59:19] PHP Parse error: parse error, unexpected T_VARIABLE, expecting ']' in /home/public/html/depts/fourh/curriculum_form_post.php on line 19
-------------
How can I go about iterating through the script? or do I just need to write 20 if/else statements and separate inserts?
Thanks,
Robert
--
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
200 Ricks Hall, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax: 919/515-7812
robert_sossomon@ncsu.edu