Ec (2); I'm learning PHP, And when I try to do it in session_start ()-Get the error message, the session cookie cannot be sent. I have seen the problem above, but I still cannot determine my error. What if it's wrong? & Lt ;? Phpsession_start (); & nbsp; if ($ _ POST [add]) & nbsp; & script ec (2); script
I am learning PHP. When I try to do this in session_start ()-to get the error message, I cannot send session cookies.
I have seen the problem above, but I still cannot determine my error.
What if it's wrong?
Session_start ();
If ($ _ POST ['add'])
{
Foreach ($ _ POST ['A _ qty '] as $ k => $ v)
{
$ _ SESSION ['cart'] [$ k] = $ _ SESSION ['cart'] [$ k] + $ v;
}
}
?>
// Look for catalog file
$ Catalogfile = "catalog. dat ";
// File is avaialbe, extract data from it and place into $ catalog, with sku as key
If (file_exists ($ catalogfile ))
{
$ Data = file ($ catalogfile );
Foreach ($ data as $ line)
{
$ LineArray = explode (":", $ line );
$ Sku = trim ($ lineArray [0]);
$ CATALOG [$ sku] ['desc'] = trim ($ lineArray [1]);
$ CATALOG [$ sku] ['price'] = trim ($ lineArray [2]);
}
}
Else
{
Die ("cocould not find the catalog file ");
}
?>
// Print items from the catalog for selectionForeach ($ CATALOG as $ k => $ v){Echo"
";
Echo"". $ V ['desc']."";
Echo" |
";Echo"
";
Echo "Price per unit:". $ CATALOG [$ k] ['price'];
Echo" |
Quantity :";
Echo"";
Echo" |
";}?>