probably stupid, but...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux