As an amateur wannabe-pro programmer, I am trying to learn not only how to
use PHP but how to do it *efficiently*. (Trust me, you don't wanna see some
of my stuff!!!) I'm noticing a number of my pages have a mixture of HTML
and PHP, very interspersed. Example: A form with 20 fields where I echo a
variable in each field to show existing data. My question is really about
the best practice to do this, as I have seen some interesting use of
includes/etc.
Is it "better" to replicate my form in HTML and insert <?PHP echo $variable;
?> in each tag?
Or would it be better to somehow put all my PHP up front and echo the HTML
at one time?
BTW, I have this same debate on a couple of pages where I do mySQL queries
2-3 times on the same page... Advice, suggestions and recommendations are
greatly appreciated!
Thanx,
Wm
use PHP but how to do it *efficiently*. (Trust me, you don't wanna see some
of my stuff!!!) I'm noticing a number of my pages have a mixture of HTML
and PHP, very interspersed. Example: A form with 20 fields where I echo a
variable in each field to show existing data. My question is really about
the best practice to do this, as I have seen some interesting use of
includes/etc.
Is it "better" to replicate my form in HTML and insert <?PHP echo $variable;
?> in each tag?
Or would it be better to somehow put all my PHP up front and echo the HTML
at one time?
BTW, I have this same debate on a couple of pages where I do mySQL queries
2-3 times on the same page... Advice, suggestions and recommendations are
greatly appreciated!
Thanx,
Wm
Comment