Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

web submission form: error trapping

General discussions related to php

Moderators: macek, egami, gesf

web submission form: error trapping

Postby remrind » Mon Sep 10, 2012 2:17 pm

I found a PHP web submission form ( ... tact-form/) online which had error trapping and nice detailing in the submission fields (diagonal stripes) which I wanted to merge with m existing submission form from CSS3Templates (, however I cannot get the fields to line up properly, it's all a little bit of a mess:

I got the fields to show up, but the style sheet conflicts are a bit of a mess, can anybody see where I'm going wrong please?

Code: Select all

<!--  This notice must remain in place!
|                                                               |
|     AUTHOR  : Jeeremie { }            |
|DESCRIPTION  : LightForm - Ajax Contact Form                   |
|   DOWNLOAD  :              |
|    VERSION  : 1.1                                             |
|       DATE  : 2008.02.03                                      |
|      EMAIL  :                           |
|    CREDITS  : Credits go to Moo Floor ( for  |
|               their fabulous FormCheck2 and to Badboy         |
|               ( his nice looking web form       |



//The CSS, XHTML, PHP and design is released under Creative Commons Attribution v2.5:

//Use of this contact form is free of charge but the copyright notes in the footer must remain intact.
//I would appreciate if you send me the URI of your site if you use LightForm.

//FormCheck ( is released under the MIT license:

//NiceForms ( is released under no specific license. You are free to use and modify but you must provide credits.

//This said, let's see how to use this contact form:


//Installation is straight forward:

//1. Download and unzip the file
//2. Copy all the files to your root directory


//Put in your email address below:
$to = '';

//User info (DO NOT EDIT!)
$name = stripslashes($_POST['name']); //sender's name
$email = stripslashes($_POST['email']); //sender's email
$website = stripslashes($_POST['website']); //sender's website

//The subject
$subject  = "[LightFormX Contact Form] "; //The default subject. Will appear by default in all messages. Change this if you want.
$subject .= stripslashes($_POST['subject']); // the subject

//The message you will receive in your mailbox
//Each parts are commented to help you understand what it does exaclty.
$msg  = "From : $name \r\n";  //add sender's name to the message
$msg .= "e-Mail : $email \r\n";  //add sender's email to the message
$msg .= "Website : $website \r\n"; //add sender's website to the message
$msg .= "Subject : $subject \r\n\n"; //add subject to the message (optional! It will be displayed in the header anyway)
$msg .= "---Message--- \r\n".stripslashes($_POST['message'])."\r\n\n";  //the message itself

//Extras: User info (Optional!)
//Delete this part if you don't need it
//Display user information such as Ip address and browsers information...
$msg .= "---User information--- \r\n"; //Title
$msg .= "User IP : ".$_SERVER["REMOTE_ADDR"]."\r\n"; //Sender's IP
$msg .= "Browser info : ".$_SERVER["HTTP_USER_AGENT"]."\r\n"; //User agent
$msg .= "User come from : ".$_SERVER["HTTP_REFERER"]; //Referrer
// END Extras


  <title>Escalier Trading</title>
  <meta name="description" content="website description" />
  <meta name="keywords" content="website keywords, website keywords" />
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  <link rel="stylesheet" type="text/css" href="css/style.css" />
  <!-- modernizr enables HTML5 elements and feature detects -->
  <script type="text/javascript" src="js/modernizr-1.5.min.js"></script>
  <link rel="shortcut icon" href="../favicon.ico" />
  <meta name="gspassport-site-verification" content="3367ac04-d4cd-4102-bfce-b63182846df8" />
  <link rel="stylesheet" href="css/main.css" type="text/css" media="screen" />

<script type="text/javascript" src="js/mootools.js"></script>

<!-- Formcheck2 / -->
<!-- -->
<script type="text/javascript" src="js/formcheck.js"></script>
<script type="text/javascript">
   window.addEvent('domready', function(){check = new FormCheck('third', {
      display : {
         fadeDuration : 500,
         errorsLocation : 1,
         indicateErrors : 1,
         showErrors : 1

<!-- NiceForms / -->
<!-- -->
<script type="text/javascript" src="js/niceforms.js"></script>



  <div id="main">
      <div id="logo"><h1>Escalier<a href="#">&nbsp;</a>Trading</h1></div>
<!--      <div id="logo"><h1>Escalier</h1></div>-->
        <ul class="lavaLampWithImage" id="lava_menu">
          <li><a href="index.html">home</a></li>
          <li><a href="about.html">about us</a></li>
          <li><a href="wines.html">wines</a></li>
          <li><a href="gifts.html">gift box</a></li>
          <li><a href="wholesale.html">wholesale</a></li>
          <li class="current"><a href="contact.php">contact us</a></li>
    <div id="site_content">
      <div id="sidebar_container">
        <div id="gallery">
          <ul class="images">
            <li class="show"><img width="450" height="450" src="images/1_b.png" alt="photo_one" /></li>
            <li><img width="450" height="450" src="images/2_b.png" alt="photo_two" /></li>
            <li><img width="450" height="450" src="images/3_b.png" alt="photo_three" /></li>
            <li><img width="450" height="450" src="images/4_b.png" alt="photo_four" /></li>

<!-- The contact form starts here-->
      $self = $_SERVER['PHP_SELF'];

    <!-- Start HTML form -->
      <form name="form" method="post" id="third" action="<?php echo $self;?>"  class="niceform">
        <!-- Name -->
      <label for="name"><strong><span class="blue">*</span> Name : </strong></label>
         <input id="name" name="name" type="text" class="validate['required','length[3,-1]','nodigit']" size="20" />

      <!-- Email -->
      <label for="email"><strong><span class="blue">*</span> Email : </strong></label>
         <input id="email" name="email" type="text" class="validate['required','length[5,-1]','email']" size="20" />

      <!-- Website -->
      <label for="site">Website : </label>
         <input id="website" name="website" type="text" class="validate['url']" size="20" />

      <!-- Subject -->
       <label for="subject"><strong><span class="blue">*</span> Subject : </strong></label>
         <input id="subject" name="subject" type="text" class="validate['required']" size="20" />

      <!-- Message -->
      <label for="msg"><strong><span class="blue">*</span> Your message : </strong></label><br />
         <textarea id="message" name="message" type="text" class="validate['required']" rows="10" cols="30"></textarea>

      <!-- Spam Check -->
       <label for="spamcheck"><span class="blue">*</span> <acronym  title="[ Spam prevention ]"><strong>Simple maths</acronym> : <span class="blue">2 + 3 = ???</span></strong></label>
         <input id="spamcheck" name="spamcheck" type="text" size="5" class="validate['required','number','spamcheck']" />

      <br /><br />
      <input type="submit" class="buttonSubmit" value="Send it!" />

       <!-- Niceforms: mouse over effect -->
      <!-- Do not remove the line below -->
      <div id="stylesheetTest"></div>


   } else {

         if  (mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n"))

        //Message sent!
        //It the message that will be displayed when the user click the sumbit button
        //You can modify the text if you want
         echo nl2br("
         <div class=\"MsgSent\">
         <p>Thank you <b><?=$name;?></b>, your message is sent!<br /> I will get back to you as soon as possible.</p>


       // Display error message if the message failed to send
        echo "
         <div class=\"MsgError\">
         <p>Sorry <b><?=$name;?></b>, your message failed to send. Try later!</p>

<!--      <p><a href="index.html">home</a> | <a href="about.html">about me</a> | <a href="portfolio.html">my portfolio</a> | <a href="blog.html">blog</a> | <a href="contact.php">contact</a></p> -->
      <p>&copy; 2012 Escalier Trading. All Rights Reserved. | <a href="">design from</a></p>

  <!-- javascript at the bottom for fast page loading -->
  <script type="text/javascript" src="js/jquery.min.js"></script>
  <script type="text/javascript" src="js/jquery.easing.min.js"></script>
  <script type="text/javascript" src="js/jquery.lavalamp.min.js"></script>
  <script type="text/javascript" src="js/image_fade.js"></script>
  <script type="text/javascript">
    $(function() {
        fx: "backout",
        speed: 700
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Sep 10, 2012 2:07 pm

Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.