WarDeities Posted March 7, 2008 Share Posted March 7, 2008 heres what I am trying to do: if(isset($_GET['page'])) { $page=$_GET['page']; $page=strip_tags($page); print"<div id='content'>"; print"$page.php<br>"; include '$page.php'; print"</p></td></tr> </div>"; } when I get page addnews from this code on same page: <a href='index.php?page=addnews'> I get this error: Warning: main(/$page.php) [function.main]: failed to open stream: No such file or directory in /index.php on line 56 I see it is not taking the vaiable (in this case addnews)...can you use vaiables in include statments??? If so please tell me how! Thanks Quote Link to comment Share on other sites More sharing options...
JasonO Posted March 7, 2008 Share Posted March 7, 2008 Take away the ' ' around the news.php variable. Putting ' ' around it makes the variable become a text string, and will actually look for $news.php, instead of the variable value itself. Quote Link to comment Share on other sites More sharing options...
WarDeities Posted March 7, 2008 Author Share Posted March 7, 2008 ...thanks...1 new problem now.... :'( This error Warning: main(addnewsphp) [function.main]: failed to open stream: No such file or directory in /index.php on line 56 Now it is not recoginizing the "." (period) any suggestions now... ? Quote Link to comment Share on other sites More sharing options...
notanoob Posted March 7, 2008 Share Posted March 7, 2008 include $page . '.php'; Quote Link to comment Share on other sites More sharing options...
WarDeities Posted March 7, 2008 Author Share Posted March 7, 2008 awesome ass hell....works perfect... THANKS!!! 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.