If I have a page with multiple <?php ... ?>
sections interspresed with pure HTML sections. I notice that a $_SESSION
varible set in one <?php ... ?>
section is not available in another on the same page.
So, what's the best practise?
1) call session_start()
as the first line of each <?php ... ?>
section?
2) only have one <?php ... ?>
section which covers the whole page? If so, I have to wrap each HTML section in echo
, which is annoying of they are HTML form elements. Maybe heredoc
them?
It's my first time to try this sort of thing, but I am not the first one to do so - what's the accepted best practise?
Edit: Aplogies, my stupid fault. One of the sections PHP started with <?
and not <?php