neobolt Posted October 25, 2009 Share Posted October 25, 2009 <?php $header = $_COOKIE['mss']['header']; $body = $_COOKIE['mss']['body']; $footer = $_COOKIE['mss']['footer']; include '$header'; include '$body'; include '$footer'; ?> The variables don't seem to get input. I receive this error. Warning: main(echo $header): failed to open stream: No such file or directory Link to comment https://forums.phpfreaks.com/topic/178980-variables-and-include/ Share on other sites More sharing options...
Alex Posted October 25, 2009 Share Posted October 25, 2009 Single quotes don't parse variables. So you're using the literal string '$header', instead of the contents of the variable $header. Instead use no quotes, or double quotes. Link to comment https://forums.phpfreaks.com/topic/178980-variables-and-include/#findComment-944281 Share on other sites More sharing options...
neobolt Posted October 25, 2009 Author Share Posted October 25, 2009 <?php $header = $_COOKIE['mss']['header']; $body = $_COOKIE['mss']['body']; $footer = $_COOKIE['mss']['footer']; include $header; include $body; include $footer; ?> You mean like this? I still get the same error. Warning: main(): Failed opening '' for inclusion (include_path='.:/usr/local/lib/php') in /home/content/m/y/s/mystartspot/html/MyStartSpot/go.php on line 8 Link to comment https://forums.phpfreaks.com/topic/178980-variables-and-include/#findComment-944288 Share on other sites More sharing options...
Alex Posted October 25, 2009 Share Posted October 25, 2009 Are you sure the variables have a value? Link to comment https://forums.phpfreaks.com/topic/178980-variables-and-include/#findComment-944293 Share on other sites More sharing options...
neobolt Posted October 25, 2009 Author Share Posted October 25, 2009 Sorry. Thanks for your help it works perfectly! I forgot that I cleared my cookies earlier so the variables no longer had their values. Link to comment https://forums.phpfreaks.com/topic/178980-variables-and-include/#findComment-944299 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.