Sorry People:
I really forget that:
Line 110:
VALUES ('$receptor[1]', '$mfi->email', '$frm[priority]', '$frm[title]',
'$frm[description]', now(), '$on_special')
which makes part of:
if (!isset ($receptor[])) {
$receptor[] = "{0,0,0,0,0,0}";
} else {
}
for ($i=0;$i<6;$i++) {
$qid = db_query("
INSERT INTO products (receptor, recipient, priority, title, description,
date_added, on_special)
VALUES ('$receptor[1]', '$mfi->email', '$frm[priority]', '$frm[title]',
'$frm[description]', now(), '$on_special')
");
}
Line 120:
for ($i = 0; $i < count($frm["categories"]); $i++) {
which makes part of:
$product_id = db_insert_id();
/* add this product under the specified categories */
for ($i = 0; $i < count($frm["categories"]); $i++) {
$qid = db_query("
INSERT INTO products_categories (category_id, product_id)
VALUES ('{$frm["categories"][$i]}', '$product_id')
");
}
An this two parts, build a function:
function insert_product($id, $frm) {
/* add a new subproduct under the parent $id. all the fields that we want
are
* going to in the variable $frm */
global $mfi, $ME;
$on_special = checked($frm["on_special"]);
/* add the product into the products table */
if (!isset ($receptor[])) {
$receptor[] = "{0,0,0,0,0,0}";
} else {
}
for ($i=0;$i<6;$i++) {
$qid = db_query("
INSERT INTO products (receptor, recipient, priority, title, description,
date_added, on_special)
VALUES ('$receptor[1]', '$mfi->email', '$frm[priority]', '$frm[title]',
'$frm[description]', now(), '$on_special')
");
}
//mail('$frm[receptor]','$frm[title]','$frm[description]','$frm[recipient]')
;
/* get the product id that was just created */
$product_id = db_insert_id();
/* add this product under the specified categories */
for ($i = 0; $i < count($frm["categories"]); $i++) {
$qid = db_query("
INSERT INTO products_categories (category_id, product_id)
VALUES ('{$frm["categories"][$i]}', '$product_id')
");
}
}
Really sorry... again
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:200211111802.38606.php-general@;gremlins.com.hk...
> On Monday 11 November 2002 17:51, Bsantos PHP wrote:
> > Hello:
> >
> > I'm building an internal messaging system for small biz companies and I
> > can't really go longer!!!!
> >
> > Problem is, I use some fields to make the message form and one of them
must
> > be a <select multiple form element wich refers to messaging persons.
This
> > is my form:
>
>
> [snip]
>
> > After this, the page should reload on submit, but I keep getting the
> > warning:
> >
> > Warning: Undefined index: 1 in
c:/apache/htdocs/sites/mail/admin/eusers.php
> > on line 110
> >
> > Warning: Undefined index: 1 in
c:/apache/htdocs/sites/mail/admin/eusers.php
> > on line 110
> >
> > Warning: Undefined index: 1 in
c:/apache/htdocs/sites/mail/admin/eusers.php
> > on line 110
> >
> > Warning: Undefined index: 1 in
c:/apache/htdocs/sites/mail/admin/eusers.php
> > on line 110
> >
> > Warning: Undefined index: 1 in
c:/apache/htdocs/sites/mail/admin/eusers.php
> > on line 110
> >
> > Warning: Undefined index: 1 in
c:/apache/htdocs/sites/mail/admin/eusers.php
> > on line 110
> >
> > Warning: Undefined index: categories in
> > c:/apache/htdocs/sites/mail/admin/eusers.php on line 120
>
> Which is line 110 and line 120?
>
> I'm certainly not going to count the lines in your code to see which lines
> they refer to.
>
> If you want people to help you, you should make it easier for them to do
so by
> indicating which lines are being referred to as 110 & 120.
>
> > All but the last, I think they appear because then page reloaded can't
see
> > any more the array of people (<select form>).
>
> Well, try using print_r() on all your important variables at strategic
places
> in your code to see that they contain what you expect them to contain.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Utility is when you have one telephone, luxury is when you have two,
> opulence is when you have three -- and paradise is when you have none.
> -- Doug Larson
> */
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php