View Full Version : echo From other PHP file
!Unreal
Apr 28th 2008, 2:26 pm
Ive got a function on one PHP file which is:
<?php
$nav = '<div>
<div align="center">
<script type="text/javascript" src="stmenu.js"></script>
</head>
<body>
<script type="text/javascript">
?>
I need to echo this onto another php file. How do I do this?
PHPGator
Apr 28th 2008, 3:30 pm
I'm assuming you mean variable instead of function?
The better way to do this I think would be to move variables (as well as functions) that will be used in multiple files and put them in a file called includes.php. Once you do that, if you intend on using them, just do <?php include('includes.php'); ?> and then you should be able to use that variable.
!Unreal
Apr 28th 2008, 3:35 pm
So how would I then echo $nav from includes to another file.
Sorry Im a complete PHP noobie.
ToddMicheau
Apr 28th 2008, 5:26 pm
<?
include('file.php');
echo $nav;
?>
n_n
!Unreal
Apr 28th 2008, 5:50 pm
<?
include('file.php');
echo $nav;
?>
n_n
thank you.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.