ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > RocketCake
forum topic indicator Contact Form w/Capatcha for Restaurant Customer
person icon
avery
Registered User
Quote
2025-07-08 21:12:59

http://ezellsfishcamp.org/contact.php

This is a Contact Form that is being tested and it works OK but there are a few things I want to add and cannot find the answers to in this forum that I can understand with my limited PHP programming knowledge. The examples shown in online Help instructions are very basic and so I am asking if someone can provide code to do the following:

1. Include senders email address in the message header "From:" that is sent instead of the my server email address.
This will make replying to the email easy.

2. Include a Subject line instead of "Contact form request".
This will make housekeeping much easier for the actual owner of the account.

Thanks!
Avery Sloanemoji icon_smile

person icon
niko
Moderator
Quote
2025-07-09 09:37:39

It's not that easy, because you need to sanitize the input, but it would work basically like this (assuming you have a field named "email" in your form) - you can base your code on the following:

$fromemail = $_POST['email'];
$to = 'youremail@example.com';
$subject = 'the subject';
$headers = 'From: $fromemail' . "\r\n" .
'Reply-To: $fromemail' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $text, $headers);


Not sure what you want as subject, but you can replace the third line to have any subject.

person icon
avery
Registered User
Quote
2025-07-09 18:16:16

Thanks! I will your code.

I wanted a subject line in the form to be entered by the sender,
and then have that subject shown the the email that is sent, instead of the default subject that is the same for every email.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |