Hello. I'm pretty new to PHP, just started looking into it today actually and I came across this php form that I would like to use however modified.
What I'm trying to do is to only have 1 inputform where you can write your email or phonenumber.
I took a php form from the net and started modifying it but I honestly have no clue what I'm doing.
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "email";
$email_subject = "Subject";
$contact_me = $_POST['contactme']; // required
$email_exp = '/^[A-Öa-ö0-9._%-]+@[A-Öa-ö0-9.-]+\.[A-Öa-ö]{2,4}$/';
if(!preg_match($email_exp,$contact_me)) {
$error_message .= MSG<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "MSG.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "MSG".clean_string($contact_me)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
Thats the form that I'm working on.
The problem at first was that nothing happened, it redirected me to a blankpage and nothing was sent.
Now it says:
Parse error: syntax error, unexpected $end in /home/eggnrice/public_html/x-productions.com/site/scripts/homecontact.php on line 34
Could anyone please help me with this contact form? I believe there are more than 1 error in it.
Thanks!