PHP starting question

liunx

Guest
Hi<br /><br />I'm knew to Php so this'll probably be an easy question. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> I have the following line of code at the top of my php file (before the <HTML> tag)<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?php<br />$foo = 'bar';<br />?><!--c2--></div><!--ec2--><br /><br />and then later<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><? $foo ?><!--c2--></div><!--ec2--><br /><br />but when I view the page, it looks like $foo was empty and the string 'bar' doesn't appear anywhere. Is there anything I'm clearly doing wrong? I'd really like to understand php better <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?php echo $foo ?><!--c2--></div><!--ec2--><!--content-->
Thanks! It worked<!--content-->
 
Back
Top