PHP in HTML

by 2 replies
3
I have a html-page (contact.html) and i want to put on that page a contact form (index.php).
I have tried two things.

1) include in contact.html:
<?php include("index.php"); ?>
--> no result, blank page

2) copy the code from index.php in contact.html:
<?php
/*
php code from index.php
*/
?>
--> the code is shown and not the contact form

What is the problem? When I open index.php directly in the browser there is no problem.
#website design #html #php
  • Banned
    [DELETED]
  • Save the contact.html as contact.php

    that should do it... and then you can include the index.php and also do the other option as well.

    Prateek
  • or you can edit your .htaccess file and tell the server to treat html as if it was a php page.

    but as pdjsolutions, changing your page to have a php extension will get it working

Next Topics on Trending Feed

  • 3

    I have a html-page (contact.html) and i want to put on that page a contact form (index.php). I have tried two things.