PHP session and multiple mixed PHP/HTML sections in one page -


if have page multiple <?php ... ?> sections interspresed pure html sections. notice $_session varible set in 1 <?php ... ?> section not available in on same page.

so, what's best practise?

1) call session_start() first line of each <?php ... ?> section?

2) have 1 <?php ... ?> section covers whole page? if so, have wrap each html section in echo, annoying of html form elements. maybe heredoc them?

it's first time try sort of thing, not first 1 - what's accepted best practise?


edit: aplogies, stupid fault. 1 of sections php started <? , not <?php

if have page multiple sections interspresed pure html sections. notice $_session varible set in 1 section not available in on same page.

the sections of php tags <?php ... ?> have nothing session. make sure put:

session_start()

on top of page.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -