Jump to content

Recommended Posts

<?php
if (isset($_POST['email']))  {


    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "daniel@drkgamers.dk";
    $email_subject = "DRKGamers Kontakt...";


    function died($error) {
        // your error code can go her
        echo "We are very, but there were error(s) found with the form your submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error. "<br /><br />";
	echo "Please go back and fix these errors.<br /><br />";
        die();

    }

  
    // validation expected data exists
    if(!isset($_POST['name'])  ||
        !isset($_POST['email'])  ||
        !isset($_POST['comments'])) {
        died('We are sorry, but there appears to be a problem with the form your submitted.');
    
    }

    $name = $_POST['name']; // required
    $email_from = $_POST['email']; //required
    $comments = $_POST['comments']; // required

    $error_message ="";
    $email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";
  if(!eregi($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';

  }
    $string_exp = "^[a-z .'-]+$";
   if(!eregi($string_exp,$name)) {
     $error_message .= 'The Name you entered does not appear to be valid.<br />';
   
    
   }
   if(strlen($comments) < 2) {
     $error_message .= 'The Comments you entered do not appear to be valid.<br />';

   }
   if(strlen($error_message) > 0) {
     died($error_message);
   }
     $email_message = "Besked Nedenunder.\n\n";

     function clean_string($string) {
       $bad = array("content-type","bcc:","to:","cc::","href");
       return str_replace($bad,"",$string);
     }

     $email_message .= "Navn: ".clean_string($name)."\n";
     $email_message .= "Email: ".clean_string($email_from)."\n";
	 $email_message .= "Besked: ".clean_string($comments). "\n";
	 $email_message .= "Ingame Navn: ".clean_string($ingame). "\n";
	 $email_message .= "Sprog: ".clean_string($sprog). "\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); ;}
?>
<html>
<head>
<title>Besked Sendt!</title>#
</head>
<body>
<center>
Din besked er sendt!
</center>
</body>
</html>

Please help and correct this script for me.

 

Link to comment
https://forums.phpfreaks.com/topic/276889-php-contact-script-help/
Share on other sites

We are not here to "DO IT FOR YOU"! If you are having problems, post the relevant code and a detail description of the problem, we will be glad to help.

 

On the other hand, if you just want someone to "DO IT", you need to post in the Freelance forum and be prepared to pay someone.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.