Page 1 of 1

Call a PHP file from HTML

Posted: Fri Aug 25, 2006 6:46 am
by loxley
Hi folks, sorry about this but I have a real irritation with this little issue.

I have a php file that when exectued returns a random text quote (straight foward).

I have a html file in the same folder that I want to return the random quote into.

Can anyone tell me a way that I can call the php file from within my HTML file to
simply return the PHP file result??

I'm loosing my marbles over this and have tried just about everything I can :(

Sorry for bieng a dork, but if ya don't know ya don't know I guess :oops:

Many thanks

Posted: Fri Aug 25, 2006 6:55 am
by richo
could you not make the HTML file a PHP file and do a

Code: Select all

require
?

Posted: Fri Aug 25, 2006 6:55 am
by JayBird
You cant unless you tell your server to parse HTML files as PHP.

Or you could just rename your HTML file to fileName.php

Posted: Fri Aug 25, 2006 6:56 am
by Jenk
You can't :)

PHP is executed server side, HTML is client side :)

Amend the PHP file to output the required HTML :)

Posted: Fri Aug 25, 2006 7:14 am
by loxley
Thanks for the feedback, renamed file, used require and . . .

yet again my neck has been saved!

Thanks all, I'll get than hang of this PHP sooner or later?

Have a good weekend all