Willem Norval
asked on
undefined variable
I inserted the default value for $custid = 0; before the first 'if'. It worked.
However, my previous carts are not emptied and there's a problem with the total - it only gives the total of the last cart.
And it's now giving this error :
Notice: Undefined variable: customers_custnum in C:\Xamp\htdocs\chapter15\c heckout3.p hp on line 96
(which is '$total', )
However, my previous carts are not emptied and there's a problem with the total - it only gives the total of the last cart.
And it's now giving this error :
Notice: Undefined variable: customers_custnum in C:\Xamp\htdocs\chapter15\c
(which is '$total', )
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I don't know. Is that the temporary file (createtemp.php)? There is nothing about that in the code you posted on the other question.
ASKER
Yes, the temporary file was created by createtemp.php, it's in my database :
CREATE TABLE carttemp(
carttemp_hidden INT(10) NOT NULL AUTO_INCREMENT,
carttemp_sess CHAR(50) NOT NULL,
carttemp_prodnum CHAR(5) NOT NULL,
carttemp_quan INT(3) NOT NULL,
PRIMARY KEY (carttemp_hidden),
KEY(carttemp_sess));
CREATE TABLE carttemp(
carttemp_hidden INT(10) NOT NULL AUTO_INCREMENT,
carttemp_sess CHAR(50) NOT NULL,
carttemp_prodnum CHAR(5) NOT NULL,
carttemp_quan INT(3) NOT NULL,
PRIMARY KEY (carttemp_hidden),
KEY(carttemp_sess));
ASKER
Here's the MySQL database copy
createtemp.docx
createtemp.docx
ASKER
I found this feedback on the textbook's forum on the same problem (couldn't quite make out what he means) :
"Please check this !!!!
Notice: a seeion had already been started - ignoring session_start() in c:\inetpub\wwwroot\cms\car t.php on line 3.
the code line reads session_start(); on line 3 of the cart.php page.
2. Notice: use of undefined constant total - assumed 'total' in c:\inetpub\wwwroot\cms\car t.php on line 89.
the code line reads $total = $extprice + $total; on line 89 of the cart.php page.
secondly i also noticed the second problem on the checkout2.php page which reads
Notice: use of undefined constant total - assumed 'total' in c:\inetpub\wwwroot\cms\che ckout2.php on line 274.
the code line reads $total = $extprice + $total; on line 274 of the cart.php page.
thirdly, i noticed that the final total is not often correct if you purchase large amount of goods for example i tried to purchase 300 CBA Coffee Mug which cost 8.95 each with extended price which is 2,685.00 and Small Grappling Hook which cost 139.95 each with extending price which is 2, 379.15 and noticed that the total before shipping is reading 4.00 and on the confirmation page its read thesame. i mean 4.00 which is not correct. "
checkout2.php
"Please check this !!!!
Notice: a seeion had already been started - ignoring session_start() in c:\inetpub\wwwroot\cms\car
the code line reads session_start(); on line 3 of the cart.php page.
2. Notice: use of undefined constant total - assumed 'total' in c:\inetpub\wwwroot\cms\car
the code line reads $total = $extprice + $total; on line 89 of the cart.php page.
secondly i also noticed the second problem on the checkout2.php page which reads
Notice: use of undefined constant total - assumed 'total' in c:\inetpub\wwwroot\cms\che
the code line reads $total = $extprice + $total; on line 274 of the cart.php page.
thirdly, i noticed that the final total is not often correct if you purchase large amount of goods for example i tried to purchase 300 CBA Coffee Mug which cost 8.95 each with extended price which is 2,685.00 and Small Grappling Hook which cost 139.95 each with extending price which is 2, 379.15 and noticed that the total before shipping is reading 4.00 and on the confirmation page its read thesame. i mean 4.00 which is not correct. "
checkout2.php
What book is this?
ASKER
Beginning PHP5, Apache, MySQL Web Development
ASKER
By Wrox books
ASKER
The other part of the problem remains - why is the cart not emptied of previous orders ?