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?
<? PHP
Session_start ();
If ($ _ post ['add'])
{
Foreach ($ _ post ['A _ qty '] as $ k => $ V)
{
$ _ Session ['cart'] [$ K] = $ _ session ['cart'] [$ K] + $ V;
}
}
?>
<? PHP
// 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]);
(Www.111cn.net) $ catalog [$ SKU] ['price'] = trim ($ linearray [2]);
}
}
Else
{
Die ("cocould not find the catalog file ");
}
?>
<Table border = "1" cellspacing = "10">
<? PHP
// Print items from the catalog for selection
Foreach ($ catalog as $ k => $ V)
{
Echo "& lt; tr & gt; <TD colspan = 2 width = 750 & gt ";
Echo "<B>". $ V ['desc']. "</B> ";
Echo "</TD> </tr> ";
Echo "<tr> <TD> ";
Echo "price per unit:". $ catalog [$ K] ['price'];
Echo "</TD> <TD> quantity :";
Echo "<input size = 4 type = text name =" a_qty [". $ K."] "> ";
Echo "</TD> </tr> ";
}
?>
From: http://www.111cn.net/phper/21/2de12f9039ff28ce01ffa0e274bb51f3.htm
Session_start () [function. Session-start]: