RE: [PHP] Re: probably stupid, but...
| From: | Mike Johnson | Date: | Fri, 12 Nov 2004 21:48:07 +0000 |
| Subject: | RE: [PHP] Re: probably stupid, but... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-201879@lists.php.net to get a copy of this message | ||
From: Robert Sossomon [mailto:LoneWolf@nc.rr.com]
> OK, I took out the extra ' that I had at the beginning, and
> then I changed everything around to:
>
> if (!empty($_POST['book_title_'.$i]))
> {
> $addtocart = "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_in
> dicator_'.$i],$_POST['ncscos_'.$i],$_POST['subject_'.$i],$_POS
> T['pages_'.$i],$_POST['c_kit_'.$i])";
> echo "$addtocart";
> mysql_query($addtocart);
>
> And it still is producing an empty page (not even echoing out
> the $addtocart variable) when I run it.
If this is just a snippet and you do close that if clause with a curly
brace later in the code, my guess is that the parser doesn't like the
$_POST['book_title_'.$i] syntax.
Try changing them all like this, if you're looking to eliminate that
possibility:
$_POST["book_title_{$i}"]
Wish I had time to test my theory, but I'm strapped at the moment. :)
--
Mike Johnson Smarter Living, Inc.
Web Developer www.smarterliving.com
mike@smarterliving.com (617) 886-5539