> To: php-general@lists.php.net
> From: mikebo...@hotmail.com
> Date: Mon, 24 Aug 2009 23:16:02 -0600
> Subject: [PHP] Beginner question
>
> I am trying to use PHP on my web site I am developing now. I have installed
> Apache 2.2 and PHP 5.2. My problem is that I can execute PHP code embedded
> in my HTML code, but I can't execute the same cose when I put it into a
> separate .php file that i then call from within the html code. for example:
>
> I have a html file with
>
> <body>
> <?php
> echo "Printing with php";
> ?>
> <?body>
>
> and it works fine.
>
> When I take out the php code and put it inot a file pp.php, and I call that
> file with my browser ("localhost/pp.php"), it works, too.
>
> But when I change the html code to:
>
> <body>
> <script type="text/javascript" src="pp.php"></script>
> </body>
>
> I get a blank page. this is probably something really stupid, but I have
> been wrecking my head for days now, and I can't figure it out. anybody has
> an idea?
>
Hello Bode,
You obviously purposefully asked your browser not to parse you php code. You
are linking to a javascript instead of a php file. It's this simple; if you are
create a .php file and u wish to incorporate it in your html code, you should
use a function called include();. Simply try something like:
<body>
<?php include(pp.php); ?>
</body>
Let me know what u get from that.
Alugo Abdulazeez
Serving you from Nigeria.
http://www.frangeovic.com
_________________________________________________________________
With Windows Live, you can organize, edit, and share your photos.
http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx