Pass PHP code to HTML

Asked

Viewed 191 times

0

I made exactly the PHP code of this video click here to have my form send the data to my e-mail.

However, now that I have the entire code, I don’t know how to pass it to my html.

Why, like, the boy example he made the form, he put all that HTML structural body in a PHP file.

And the form of my site, is along with the entire site in the HTML file. How would I make the form work?

<?php
$msg=0;
@$msg= $_REQUEST['msg'];
?> 

This above code, I will have to put above the initial html code, and if the file is html, it will not work.

<!DOCTYPE html>
<html>
<head> etc...

And there’s another external php tbm file.

  • you will have to play inside the desired file on the site and transfer the extension of this file to . php, but you will have no problem doing so

1 answer

3


So Lukas, it is not possible to include a snippet of PHP code in an HTML file, that should be . php, you must change the extension of your . html file to . php and insert the code.

You are running this project on your machine locally or are on an online server?

  • I’m using shaman to do php, and it’s already working, sent to my e-mail right.. so I would have no problem changing the file of my site that is HTML, for php?

  • In no way, you should only pay attention to the fact that if you have created a link on another page giving as a reference for example contact.html, in this link you will have to change to contact.php.

  • ah yes.. so when I go up the site to the hosting server, it’s okay to upload the index file, like index.php? I didn’t know that. I’m new to the area, but, thanks!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.