Session_start () [function. session-start]:-PHP source code

Source: Internet
Author: User
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" ";}?>
";
Echo"". $ V ['desc']."";
Echo"
";
Echo "Price per unit:". $ CATALOG [$ k] ['price'];
Echo"
Quantity :";
Echo"";
Echo"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.