How to use session_start? At the end of this post, xwmr1988 was used to edit session. auto_start0 page 1 index. php: & lt;? in php. ini from 2013-11-0516: 07: 59 ;? Php & nbsp; session_start ();? & Gt; & lt ;? How to use phpif (isset ($ _ POST [submi session_start?
This post was last edited by xwmr1988 at 16:07:59, January 5 ,.
Session. auto_start = 0 in php. ini
Page 1 index. php:
If (isset ($ _ POST ['submit ']) {
$ _ SESSION ['Season '] =_ _ POST ['Season'];
Header ('Location: test. php ');
}
?>
Storage session
Select the data to be set:
Page 2 test. php:
Session_start ();
?>
$ Season = $ _ SESSION ['Season '];
Echo'Read session
';
Switch ($ season ){
Case 'spring ':
Echo 'green spring now ';
Break;
Case 'Summer ':
Echo 'the summer is full of enthusiasm now ';
Break;
Case 'loan ':
Echo 'The autumn is fruitful now ';
Break;
Case 'Winter ':
Echo 'snow-white winter now ';
Break;
Default:
Echo 'Sorry, the session does not contain data or does not exist. ';
}
?>
Run Page 1:
Submit to page 2:
Why does this warning appear? How can this problem be solved? Besides setting session. auto_start = 1
Share:
------ Solution --------------------
Check that test. php does not have a bom header.