0

Hi guys hope i can get some help

am struggling to get my contacts page to submit a form to my email address... http://www.dytelligence.co.za/contacts.php could any1 out there please view my source code and tell me what i need to change on the code. thank you in advance. is the a way to attach a file on this website?

regards,
Tshepo from RSA

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by nhadat.com.vn
0
<!DOCTYPE html>
<html lang="en">
<head>
<title>Contacts - Dytelligence IT Solutions (PTY)</title>
<meta name="description" content="Place your description here">
<meta name="keywords" content="put, your, keyword, here">
<meta name="author" content="Templates.com - website templates provider">
<meta charset="utf-8">
<link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
<link rel="stylesheet" href="css/layout.css" type="text/css" media="all">
<link rel="stylesheet" href="css/style.css" type="text/css" media="all">
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/cufon-replace.js"></script>
<script type="text/javascript" src="js/Myriad_Pro_300.font.js"></script>
<script type="text/javascript" src="js/Myriad_Pro_400.font.js"></script>
<script type="text/javascript" src="js/Myriad_Pro_600.font.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<!--[if lt IE 7]>
<script type="text/javascript" src="http://info.template-help.com/files/ie6_warning/ie6_script_other.js"></script>
<![endif]-->
<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<![endif]-->
</head>
<body id="page6">
<div class="tail-top1">
<!-- header -->
    <header>
        <div class="container">
            <div class="header-box">
                <div class="left">
                    <div class="right">
                        <nav>
                            <ul>
                                <li><a href="index.html">Home</a></li>
                                <li><a href="services.html">Services</a></li>
                                <li><a href="hosting.html">Hosting</a></li>
                                <li><a href="solutions.html">Solutions</a></li>
                                <li><a href="support.html">Support</a></li>
                                <li class="current"><a href="contacts.php">Contacts</a></li>
                            </ul>
                        </nav>
                        <h1><a href="index.html"><span>Dytelligence</span>IT</a></h1>
                    </div>
                </div>
            </div>
            <span class="top-info">24/7 Sales &amp; Support  &nbsp;l  &nbsp;<a href="mailto:support@dytelligence.co.za">support@dytelligence.co.za</a>
        </div>
    </header>
              <?php
if(isset($_POST['email'])) {

    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "info@dytelligence.co.za";
    $email_subject = "Dytelligence Info";


    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you 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['first_name']) ||
        !isset($_POST['email']) ||
        !isset($_POST['telephone']) ||
        !isset($_POST['comments'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted.');      
    }

    $first_name = $_POST['first_name']; // required
    $email_from = $_POST['email']; // required
    $telephone = $_POST['telephone']; // not required
    $comments = $_POST['comments']; // required

    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  }
    $string_exp = "/^[A-Za-z .'-]+$/";
  if(!preg_match($string_exp,$first_name)) {
    $error_message .= 'The First 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 = "Form details below.\n\n";

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

    $email_message .= "First Name: ".clean_string($first_name)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "Telephone: ".clean_string($telephone)."\n";
    $email_message .= "Comments: ".clean_string($comments)."\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); 
?>

<!-- include your own success html here -->

Thank you for contacting us. We will be in touch with you very soon.

<?php
}
?>
<!-- content -->
    <section id="content"><div class="ic">More Website Templates at TemplateMonster.com!</div>
        <div class="container">
            <div class="inside">
                <div id="slogan">
                    <div class="inside">
                        <marquee>
                        <h2><span>our</span> services</h2>
                        <p><br><h1><h4><b>Custom Software Development, Web Design and Development,<br /><p>Hosting Services, Graphic Design, SEO, IT Support Engineering.</b></h4></h1></p>
                        </marquee>
                    </div>
                </div>
                <ul class="banners wrapper">
                    <li><a href="hosting.html">Basic  &nbsp; <b>R150.00</b></a></li>
                    <li><a href="hosting.html">Standard  &nbsp; <b>R200.00</b></a></li>
                    <li><a href="hosting.html">Gold  &nbsp; <b>R500.00</b></a></li>
                    <li><a href="hosting.html">Platinum  &nbsp; <b>R1000.00</b></a></li>
                </ul>
                <div class="inside1">
                    <div class="wrap">
                        <article class="col-1">
                            <h2>Postal Address</h2>
                            <address>
                                552 Milder street<br />
                                The reeds X 4<br />
                                Centurion<br />
                                0154<br />
                                Contact no: +27(0) 727745103<br />
                                Fax to email: +27(0) 866592675<br />
                                Email: <a href="mailto:info@dytelligence.co.za">info@dytelligence.co.za</a>
                            </address>
                          </article>
                        <article class="col-2">
                            <h2>Contact Dytelligence IT Solutions</h2>
                            <form id="contacts-form" method="post" action="contacts.php">
                                <fieldset>
                                    <div class="field text"><label>Your Name:</label><input name="first_name" type="text"></div>
                                    <div class="field text"><label>Your E-mail:</label><input name="email" type="email"></div>
                                    <div class="field"><label>Your Message:</label><textarea name="comments"></textarea></div>
                                    <div class="alignright"><a href="#" class="link4" onClick="document.getElementById('contacts-form').reset()"><span><span>Clear</span></span></a><a href="" class="link2" value="submit"><span><span>Send</span></span></a>
                                </fieldset>
                            </form>
                        </article>
                        <div class="clear"></div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<<!-- aside -->
<aside>
    <div class="container">
        <div class="inside">
            <div align="center"><div class="soc-icons"><span>Follow Us:     </span><a href="https://twitter.com/#!/DytelligenceIT" target="_new"><img src="images/icon-1.jpg" alt=""></a>
                    <a href="http://www.facebook.com/DytelligenceItSolutions" target="_new"><img src="images/icon-2.jpg" alt=""></a>
                </div>
</div>                       

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</aside>
<script type="text/javascript"> Cufon.now(); </script>
</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.