Forum Moderators: coopster

Message Too Old, No Replies

How to call a php script from another file

         

porky

11:15 am on Nov 7, 2004 (gmt 0)

10+ Year Member



Please help!

How can I call a php script from another file?
I have one file, called menu.php. But I'd like to call this script from another file, called another.php. How can I do this?

DanA

12:01 pm on Nov 7, 2004 (gmt 0)

10+ Year Member



You can use include in another.php :
<?php
include ('menu.php');
...the rest of the script...
?>
assuming the file another.php is in the same folder as menu.php

porky

2:10 pm on Nov 7, 2004 (gmt 0)

10+ Year Member



Thanks a lot. :)

ergophobe

4:17 pm on Nov 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hey Porky,

Welcome to WebmasterWorld.

You may wish to read the manual regarding include() [us2.php.net]

In fact, since it sounds like you're just beginning, I strongly recommend that you download the manual for use on your local machine. If nothing else, it will save the PHP site some bandwidth, because you'll probably be using it a lot. More importantly, though, I find that it's generally easier to locate information in the Windows Help version of the manual than the online manual.

Some helpful reading RE WebmasterWorld: New member welcome [webmasterworld.com] thread.

Tom