thomseddon Posted June 21, 2008 Share Posted June 21, 2008 ok so i have always used something like this: <?php $name = "thom"; ?> <html> my name is: <?=$name?> </html> expecting the output just to be: my name is: thom but i have recently moved to a new host and i cannot use this, in this example i would just get my name is: why is this? i am told php5 is installed should i ask them to reinstall it, is there an alternative function? (tia!!) Quote Link to comment Share on other sites More sharing options...
phpSensei Posted June 21, 2008 Share Posted June 21, 2008 That is some bad coding practice. try Code: <?php $name = "thom"; ?> <html> my name is: <?php echo $name; ?> </html> Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 21, 2008 Share Posted June 21, 2008 Indeed. You were using "short tags" to echo it, which is sloppy, not guaranteed to work on all servers (obviously), and lazy. thebadbad showed the proper way to do it. Quote Link to comment Share on other sites More sharing options...
thomseddon Posted June 21, 2008 Author Share Posted June 21, 2008 my bad!!! so why is it different on different servers!? i never realised it was naughty script!!! (guess that what come from teaching yourself lol) Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 21, 2008 Share Posted June 21, 2008 Because most servers these days turn off the short tags directive in php.ini. =P Quote Link to comment Share on other sites More sharing options...
dannyb785 Posted June 21, 2008 Share Posted June 21, 2008 Yep... just one of them things Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.