Hodo Posted June 11, 2007 Share Posted June 11, 2007 Is it possible to call a php function from inside a html file? If so what is the syntax? Quote Link to comment https://forums.phpfreaks.com/topic/55172-calling-php-from-html/ Share on other sites More sharing options...
ToonMariner Posted June 11, 2007 Share Posted June 11, 2007 php is processed and finished when the users sees the full page so no html cannot call a php file. I suspect your are trying to make a php template in which case include and require are your friends - you'll find them explained in the manual. Quote Link to comment https://forums.phpfreaks.com/topic/55172-calling-php-from-html/#findComment-272732 Share on other sites More sharing options...
trq Posted June 13, 2007 Share Posted June 13, 2007 Not unless your server is setup to parse the *.html extension as php. Quote Link to comment https://forums.phpfreaks.com/topic/55172-calling-php-from-html/#findComment-273987 Share on other sites More sharing options...
CrazeD Posted June 14, 2007 Share Posted June 14, 2007 Instead just put your regular HTML into the PHP file. Quote Link to comment https://forums.phpfreaks.com/topic/55172-calling-php-from-html/#findComment-274451 Share on other sites More sharing options...
adam84 Posted June 20, 2007 Share Posted June 20, 2007 it depends on what you are trying to do. If you are trying to retrieve info from a db, then you could use ajax/javascript. Quote Link to comment https://forums.phpfreaks.com/topic/55172-calling-php-from-html/#findComment-278462 Share on other sites More sharing options...
Northern Flame Posted June 26, 2007 Share Posted June 26, 2007 depending on what you want done, you could write the php function on a seperate page, lets say, "function.php", and then in your HTML file write: <?php include "/function.php"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/55172-calling-php-from-html/#findComment-282653 Share on other sites More sharing options...
ardyandkari Posted June 29, 2007 Share Posted June 29, 2007 depending on what you want done, you could write the php function on a seperate page, lets say, "function.php", and then in your HTML file write: <?php include "/function.php"; ?> once again...this assumes that the server is set up to parse html files for php... it is just easier to save the file as php... Quote Link to comment https://forums.phpfreaks.com/topic/55172-calling-php-from-html/#findComment-285725 Share on other sites More sharing options...
RichardRotterdam Posted June 29, 2007 Share Posted June 29, 2007 Hmm no mentioned Ajax yet Ajax is able to call a php function on an external php file from your *html file Quote Link to comment https://forums.phpfreaks.com/topic/55172-calling-php-from-html/#findComment-285983 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.