Inserting PHP Code into a web page
I would like to insert the following PHP code into a web page.
It sends me an email every time someone opens the web page.
Could someone explain how to do this?
THE PHP CODE:
pSendEmail () ;
//******** FUNCTIONS ***************
Function pSendEmail ()
//$pos = strpos($Email, "@");
//$Email = mb_substr($Email, 0, ($pos-1));
$title = "HseMgr PH: Tenants-Current-View.php just Opened";
$message = "This page is open to Administrator and House Helper/Manager
mail("firstname.lastname@example.org", $title, $message, "From: PH <email@example.com>\nReply-To: firstname.lastname@example.org");
First is your site hosted on Coffeecup? If so you won't be able to do any php coding.
If it's on a different host then there are a couple of ways to do this.
One way is to export your project and insert the code into the page with a html editor.
You may need to change the page name extension to .php if your host isn't setup to parse php within HTML.
The other way is to setup your host to parse php inside html pages. This will allow you to leave the page names as is. To parse php inside html pages you need to add a line of code to your .htaccess file on your host.
Either way you can insert the code into a html element before export if you want but it won't work until you upload the site.
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
This is a site I built for use in my job.(HTML Editor)
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.