bgbs Posted October 30, 2009 Share Posted October 30, 2009 I wan to have the ability to change certain data on the site from one file; to modify items and not have to go into each page that reflects that description or title. So I created a php file naming it data.php In data.php I put this $phone = "1.877.894.8555"; $email = "info [at] mobirecycle.com"; Then I included data.php file into my global header like this: <?php include("data.php");?> Then in the php file I put the echo statement like this: <p><span class="bold">Mobirecycle can be contacted at:</span> <?php echo "$phone"; ?></p> What it does is just spit everything that is in the data.php file, including all the code, on the header, and nothing appears in the echo statement. What have I done wrong? Quote Link to comment https://forums.phpfreaks.com/topic/179680-solved-need-help-figuring-out-this-php-include/ Share on other sites More sharing options...
Alex Posted October 30, 2009 Share Posted October 30, 2009 You still need to wrap your PHP inside included files with appropriate php tags. <?php $phone = "1.877.894.8555"; $email = "info [at] mobirecycle.com"; ?> Otherwise it'll be read like any other file, not parsed by PHP, so those variables are never stored. Quote Link to comment https://forums.phpfreaks.com/topic/179680-solved-need-help-figuring-out-this-php-include/#findComment-948042 Share on other sites More sharing options...
bgbs Posted October 30, 2009 Author Share Posted October 30, 2009 wow, you're a genius Quote Link to comment https://forums.phpfreaks.com/topic/179680-solved-need-help-figuring-out-this-php-include/#findComment-948048 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.