The contact form on contact-us.html now submits to api/contact.php.
-
The frontend auto-detects the API URL, so the same code works on localhost and Hostinger.
-
Supported deployment styles: domain root (for example
/api/contact.php) and subfolder installs (for example/your-folder/api/contact.php). -
Every valid submission is saved to
data/contact_submissions.jsonl. -
An admin email notification is sent for each submission.
- PHP must be enabled on the hosting server.
- PHP
mail()must be configured (SMTP/sendmail on the server). - Optional: set
ADMIN_EMAILenvironment variable on the server to override the default recipient (info@medtechsimulation.com). - The website must be served through IIS/Apache/Nginx with PHP enabled (opening HTML files directly from disk will not execute
api/contact.php).
- Contact page can POST to
api/contact.phpfrom both/contact-usand/contact-us.htmlroutes. - Backend validates required fields (
name,email,message) and email format. - Honeypot field (
website) blocks basic bot submissions. - Valid submissions are appended to
data/contact_submissions.jsonl. - Backend returns JSON for all responses.
- Optional email notification is attempted using PHP
mail().
- If form status shows "Contact service is not configured correctly on this server", PHP is not executing or endpoint response is not JSON.
- If submissions fail with storage errors, grant write permission to the project folder so PHP can create and write to
data/. - If file logging works but no emails arrive, SMTP/mail settings are not configured correctly for PHP.
-
Enable PHP in IIS (FastCGI)
- Install PHP for Windows.
- In IIS Manager, open Handler Mappings and ensure
*.phpis mapped tophp-cgi.exe. - In IIS Manager, open FastCGI Settings and confirm PHP is registered.
-
Configure PHP mail in
php.ini- Edit your active
php.iniand set SMTP values, for example:
- Edit your active
[mail function]
SMTP = smtp.your-provider.com
smtp_port = 587
sendmail_from = no-reply@yourdomain.com- Set admin recipient email for this app
- Add
ADMIN_EMAILas a Windows environment variable (System Properties -> Environment Variables), or set it for the IIS Application Pool identity environment. - Example value:
- Add
ADMIN_EMAIL=admin@yourdomain.com
- Restart IIS after changes
iisreset- Test
- Submit the contact form from
contact-us.html. - Confirm new entries are saved in
data/contact_submissions.jsonl. - Confirm admin inbox receives the notification email.
- Submit the contact form from
- Double-click
start-php-local.batin the project root. - It starts PHP at
http://127.0.0.1:8000and openscontact-usautomatically. - Keep that terminal window open while testing the contact form.
- Press
Ctrl + Cin that window to stop the local server.