Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    135
    Thanks
    29
    Thanked 1 Time in 1 Post

    contact form css

    Hey guys and gals,

    I downloaded a contact form and it has it's own 3 css files. The main file is called mainform.php and I included that in my template as in <?php include(mainform.php); ?>

    Is there any way to make the contact form gets its CSS values only from the 3 css files it came with or do I have to include all the css values into my main CSS file, which is from the template?

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello OGGordon,
    You should be able to add the lines
    <link href="my1.css" rel="stylesheet" type="text/css" />
    <link href="my2.css" rel="stylesheet" type="text/css" />
    <link href="my3.css" rel="stylesheet" type="text/css" />

    to the head of document your loading your .php from and the include will link to them.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    135
    Thanks
    29
    Thanked 1 Time in 1 Post
    hey excavator,

    will that infere with my other css file? because some of the values are the same such as h1 tags.

  • #4
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    I see the problem.
    Try something like this...
    Code:
    <?php
    echo '<head>';    
    echo ' <link rel="stylesheet" href="your.css" type="text/css">';
    echo '</head>';
    require( "your.php" );
    $Quote = new CQuote;
     if( $Quote->Get( $strQuote ) == 0 )	
    echo $strQuote;
    ?>
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #5
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Also found this -
    Code:
    <?php
    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">';
    echo 'body {
    	background-color: #330000;
    }
    h1 {
    	color: #FF6666;
    }
    h2 {
    	color: #FF99CC;
    }
    h3, h4 {
    	color: #CC9999;
    }
    h5, h6 {
    	color: #FFCCCC;
    }
    a {
    	color: #FF0033;
    }
    echo '</style>
    </head>
    <body>';
    require( "your.php" );
    $Quote = new CQuote;
     if( $Quote->Get( $strQuote ) == 0 )	echo $strQuote;
    echo '</body></html>';
    ?>
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #6
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    135
    Thanks
    29
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Excavator View Post
    I see the problem.
    Try something like this...
    Code:
    <?php
    echo '<head>';    
    echo ' <link rel="stylesheet" href="your.css" type="text/css">';
    echo '</head>';
    require( "your.php" );
    $Quote = new CQuote;
     if( $Quote->Get( $strQuote ) == 0 )	
    echo $strQuote;
    ?>
    hey ex, Im kind of confused. But let me explain the files:

    kontakt.php (template, include(mailform.php))
    mailform.php (contact form)
    main.css (css for contact form)

    So if I were to plug in my file names for the above quote, is this correct?

    <?php
    echo '<head>';
    echo ' <link rel="stylesheet" href="css/main.css" type="text/css">';
    echo '</head>';
    require( "kontakt.php" );
    $Quote = new CQuote;
    if( $Quote->Get( $strQuote ) == 0 )
    echo $strQuote;
    ?>

    Btw. I insert that code in mailform.php or?<?php

  • #7
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    135
    Thanks
    29
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Excavator View Post
    Also found this -
    Code:
    <?php
    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">';
    echo 'body {
    	background-color: #330000;
    }
    h1 {
    	color: #FF6666;
    }
    h2 {
    	color: #FF99CC;
    }
    h3, h4 {
    	color: #CC9999;
    }
    h5, h6 {
    	color: #FFCCCC;
    }
    a {
    	color: #FF0033;
    }
    echo '</style>
    </head>
    <body>';
    require( "your.php" );
    $Quote = new CQuote;
     if( $Quote->Get( $strQuote ) == 0 )	echo $strQuote;
    echo '</body></html>';
    ?>
    I could replace that just with my CSS values right?

  • #8
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Quote Originally Posted by OGGordon View Post
    I could replace that just with my CSS values right?
    Yes, that would be attached CSS within the include.
    The other solution would link a CSS file to your include.

    Did you get one working?
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #9
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    135
    Thanks
    29
    Thanked 1 Time in 1 Post
    neither one seems to be working or I'm doing something wrong.

    Here are both files:

    PHP Code:
    <?php
    session_start
    ();
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    <!--  This notice must remain in place!
     _______________________________________________________________
    |                                                               |
    |     AUTHOR  : Jeeremie { http://web-kreation.com }            |
    |DESCRIPTION  : LightForm - Ajax Contact Form                   |
    |   DOWNLOAD  : http://web-kreation.com/blog/?p=71              |
    |    VERSION  : 1.0                                             |
    |       DATE  : 2008.02.03                                      |
    |      EMAIL  : info@web-kreation.com                           |
    |    CREDITS  : Credits go to Moo Floor (www.moo.floor.ch) for  |
    |               their fabulous FormCheck2 and to Badboy         |
    |               (www.badboy.ro) his nice looking web form       |
    |_______________________________________________________________|
    -->

    <?php

    //========
    //LICENSE
    //========

    //The CSS, XHTML, PHP and design is released under Creative Commons Attribution v2.5:
    //http://creativecommons.org/licenses/by/2.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 (http://moo.floor.ch/?p=18) is released under the MIT license:
    //http://www.opensource.org/licenses/mit-license.php

    //NiceForms (http://www.badboy.ro/articles/2005-07-23/niceforms_preview/) 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
    //=============

    //Installation is straight forward:

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


    //==============
    //CONFIGURATION
    //==============

    //IMPORTANT!!
    //Put in your email address below:
    $to 'sa@mr-sa.com';


    //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  "[Q8iEnG Site..] "//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.
    //YOU DON'T NEED TO EDIT IT BELOW BUT IF YOU DO, DO IT WITH CAUTION!
    $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

    ?>

    <head>
    <!-- Formcheck2 / Moo.Floor.ch -->
    <!-- http://moo.floor.ch/?p=18 -->
    <link rel="stylesheet" href="js/formcheck/formcheck.css" type="text/css" media="screen" />
    <script type="text/javascript" src="js/mootools.js"></script>
    <script type="text/javascript" src="js/formcheck/formcheck.js"></script>
    <script type="text/javascript">
        window.addEvent('domready', function(){check = new FormCheck('third', {
            display : {
                fadeDuration : 500,
                errorsLocation : 1,
                indicateErrors : 1,
                showErrors : 1
            }
        })});
    </script>

    <!-- NiceForms / BadBoy.ro -->
    <!-- http://www.badboy.ro/articles/2005-07-23/niceforms_preview/ -->
    <link rel="stylesheet" href="js/niceform/niceforms-default.css" type="text/css" media="screen" />
    <script type="text/javascript" src="js/niceform/niceforms.js"></script>


    </head>
    <body>

    <?php
    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">'
    ;
    echo 
    '*{
        font-family: tahoma, verdana, "sans-serif";
        margin: 0;
        padding: 0;
        font-size: 95%;


    body{
        background: white;
    }

    a, a:hover{
        text-decoration: none;
        color: #48f;
    }
    a:hover{
        color: #33CCFF;
    }

    p{
        font-size: 90%;
        margin-top: 1em;
        margin-bottom: 2em;
        color: #333;
    }

    h1 {
        color: #0099CC;
        font-size: 1.6em;
    }


    /* Form */
    form {
        width: 400px;
        border: 1px solid #EEE;
        padding: 10px;
        margin: 40px auto;
    }

    label {
        display: block;
        margin-top : 8px;
        width: 100%;
        background-repeat: no-repeat;
    }

    img {
        border:0;
    }

    .blue {
        color: #0099CC;
        font-weight: bold;
    }

    /* footer */
    .dwnld {
        Display: block;
        padding: 10px;
        text-align: center;
        width: 400px;
        margin: 0 auto;
        border: 1px solid #EEE;
        background-color: white;
        color: #999;
        font-size: 1.4em;
        font-weight: bold;
        line-height: 50px;
        background: url(../images/download.gif) no-repeat 40px 10px;
    }

    /* footer */
    .footer {
        Display: block;
        padding: 10px;
        margin: 40px auto;
        width: 400px;
        text-align: center;
        border: 1px solid #EEE;
        background-color: white;
        color: #999;
    }

    .footer p {
        color: #999;
    }

    /* Congratulation message */
    .MsgSent {
        Display: block;
        padding: 10px;
        margin: 40px auto;
        width: 400px;
        text-align: center;
        border: 1px solid #EEE;
        background-color: white;
    }

    .MsgSent h1 {
        background: url(../images/MsgSent.gif) no-repeat 0 0;
        padding-left: 20px;
        height: 85px;
        line-height: 85px;
    }

    /* Error message */
    .MsgError {
        Display: block;
        padding: 10px;
        margin: 40px auto;
        width: 400px;
        text-align: center;
        border: 1px solid #EEE;
        background-color: white;
    }

    .MsgError h1 {
        background: url(../images/MsgError.gif) no-repeat 0 0;
        padding-left: 20px;
        height: 85px;
        line-height: 85px;
        color: #CC0000;
    }

    .MsgSent p, .MsgError p {
        font-size: 1.3em;
        color:#999;
    }



    echo '
    </style>
    </
    head>
    <
    body>';
    require( "your.php" );
    $Quote = new CQuote;
     if( $Quote->Get( $strQuote ) == 0 )    echo $strQuote;
    echo '
    </body></html>';
    ?>

    <!-- The contact form starts here-->
    <?php
       if ($_SERVER['
    REQUEST_METHOD'] != 'POST'){
          $self = $_SERVER['
    PHP_SELF'];
    ?>

        <!-- Start HTML form -->
           <form name="form" method="post" id="third" action="<?php echo $self;?>">
            <h1>:::Contact us:::</h1>

            <!-- 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'] textinput" />

            <!-- 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'] textinput" />

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

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

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

            <!-- Spam Check -->
            <br>
            <span class="blue">*</span><strong>Are you human? : <br/> <img src="captcha.php"> </strong>
                <input id="captchacode" name="captchacode" type="text" size="5" class="validate['
    required'] textinput_small" />

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

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


    <?php
        } else {
            error_reporting(0);
            
            if($_POST['
    captchacode'] != $_SESSION['captchacode'] OR $_SESSION["captchacode"]=='
    {
        die(
    "<div class=\"MsgError\">
                <h1>Error!!</h1>
                <p>Sorry , Error in the verification code, please try again!</p>
            </div>"
    );
    }
              if (
    mail($to$subject$msg))

              
    //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\">
                <h1>Congratulations!!</h1>
                <p>Thank you <b><?=$name;?></b>, your message is sent!<br /> I will get back to you as soon as possible.</p>
            </div>
           "
    );

               else

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

    </body>
    </html>













    <!--  This notice must remain in place!
     _______________________________________________________________
    |                                                               |
    |     AUTHOR  : Jeeremie { http://web-kreation.com }            |
    |DESCRIPTION  : LightForm - Ajax Contact Form                   |
    |   DOWNLOAD  : http://web-kreation.com/blog/?p=71              |
    |    VERSION  : 1.0                                             |
    |       DATE  : 2008.02.03                                      |
    |      EMAIL  : info@web-kreation.com                           |
    |    CREDITS  : Credits go to Moo Floor (www.moo.floor.ch) for  |
    |               their fabulous FormCheck2 and to Badboy         |
    |               (www.badboy.ro) his nice looking web form       |
    |_______________________________________________________________|
    -->

    PHP Code:
    <?php
    session_start
    ();
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    <!--  This notice must remain in place!
     _______________________________________________________________
    |                                                               |
    |     AUTHOR  : Jeeremie { http://web-kreation.com }            |
    |DESCRIPTION  : LightForm - Ajax Contact Form                   |
    |   DOWNLOAD  : http://web-kreation.com/blog/?p=71              |
    |    VERSION  : 1.0                                             |
    |       DATE  : 2008.02.03                                      |
    |      EMAIL  : info@web-kreation.com                           |
    |    CREDITS  : Credits go to Moo Floor (www.moo.floor.ch) for  |
    |               their fabulous FormCheck2 and to Badboy         |
    |               (www.badboy.ro) his nice looking web form       |
    |_______________________________________________________________|
    -->

    <?php

    //========
    //LICENSE
    //========

    //The CSS, XHTML, PHP and design is released under Creative Commons Attribution v2.5:
    //http://creativecommons.org/licenses/by/2.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 (http://moo.floor.ch/?p=18) is released under the MIT license:
    //http://www.opensource.org/licenses/mit-license.php

    //NiceForms (http://www.badboy.ro/articles/2005-07-23/niceforms_preview/) 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
    //=============

    //Installation is straight forward:

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


    //==============
    //CONFIGURATION
    //==============

    //IMPORTANT!!
    //Put in your email address below:
    $to 'sa@mr-sa.com';


    //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  "[Q8iEnG Site..] "//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.
    //YOU DON'T NEED TO EDIT IT BELOW BUT IF YOU DO, DO IT WITH CAUTION!
    $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

    ?>

    <head>
    <!-- Formcheck2 / Moo.Floor.ch -->
    <!-- http://moo.floor.ch/?p=18 -->
    <link rel="stylesheet" href="js/formcheck/formcheck.css" type="text/css" media="screen" />
    <script type="text/javascript" src="js/mootools.js"></script>
    <script type="text/javascript" src="js/formcheck/formcheck.js"></script>
    <script type="text/javascript">
        window.addEvent('domready', function(){check = new FormCheck('third', {
            display : {
                fadeDuration : 500,
                errorsLocation : 1,
                indicateErrors : 1,
                showErrors : 1
            }
        })});
    </script>

    <!-- NiceForms / BadBoy.ro -->
    <!-- http://www.badboy.ro/articles/2005-07-23/niceforms_preview/ -->
    <link rel="stylesheet" href="js/niceform/niceforms-default.css" type="text/css" media="screen" />
    <script type="text/javascript" src="js/niceform/niceforms.js"></script>


    </head>
    <body>
    <?php
    echo '<head>';    
    echo 
    ' <link rel="stylesheet" href="your.css" type="text/css">';
    echo 
    '</head>';
    require( 
    "your.php" );
    $Quote = new CQuote;
     if( 
    $Quote->Get$strQuote ) == )    
    echo 
    $strQuote;
    ?>
    <!-- The contact form starts here-->
    <?php
       
    if ($_SERVER['REQUEST_METHOD'] != 'POST'){
          
    $self $_SERVER['PHP_SELF'];
    ?>

        <!-- Start HTML form -->
           <form name="form" method="post" id="third" action="<?php echo $self;?>">
            <h1>:::Contact us:::</h1>

            <!-- 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'] textinput" />

            <!-- 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'] textinput" />

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

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

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

            <!-- Spam Check -->
            <br>
            <span class="blue">*</span><strong>Are you human? : <br/> <img src="captcha.php"> </strong>
                <input id="captchacode" name="captchacode" type="text" size="5" class="validate['required'] textinput_small" />

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

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


    <?php
        
    } else {
            
    error_reporting(0);
            
            if(
    $_POST['captchacode'] != $_SESSION['captchacode'] OR $_SESSION["captchacode"]==''
    {
        die(
    "<div class=\"MsgError\">
                <h1>Error!!</h1>
                <p>Sorry , Error in the verification code, please try again!</p>
            </div>"
    );
    }
              if (
    mail($to$subject$msg))

              
    //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\">
                <h1>Congratulations!!</h1>
                <p>Thank you <b><?=$name;?></b>, your message is sent!<br /> I will get back to you as soon as possible.</p>
            </div>
           "
    );

               else

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

    </body>
    </html>













    <!--  This notice must remain in place!
     _______________________________________________________________
    |                                                               |
    |     AUTHOR  : Jeeremie { http://web-kreation.com }            |
    |DESCRIPTION  : LightForm - Ajax Contact Form                   |
    |   DOWNLOAD  : http://web-kreation.com/blog/?p=71              |
    |    VERSION  : 1.0                                             |
    |       DATE  : 2008.02.03                                      |
    |      EMAIL  : info@web-kreation.com                           |
    |    CREDITS  : Credits go to Moo Floor (www.moo.floor.ch) for  |
    |               their fabulous FormCheck2 and to Badboy         |
    |               (www.badboy.ro) his nice looking web form       |
    |_______________________________________________________________|
    -->

    When I try the first one, it gives me a parse error on line 254 which is "echo '</style>

    and the second one doesn't even make the page load.

  • #10
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    See if this site has a solution...
    http://www.ntchosting.com/php/php-in...PHP_using_echo

    I've never done this either so I'm not much help.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #11
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    wouldn't it just be easier to take the CSS from the contact form and paste it in to your main css, then give each element an ID of say, #my_contact_form

    #my_contact_form h1
    #my_contact_form p
    #my_contact_form input

    etc.

    then just wrap said contact form in <div id="my_contact_form"></div>

    or am i losing it

  • #12
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    135
    Thanks
    29
    Thanked 1 Time in 1 Post
    hey met,

    so I have included all 3 css files from the contact form into my main css file which is style.css

    I made it exactly how you wrote, with the wrap around the entire thing and called it "mailform"

    Then proceeded to add #mailform at every beginning of each values from the 3 css files

    The form works now, but there are some issues. Like error msg's don't appear for some reason.

    here's a working version of the form:

    http://derderder.cwsurf.de/kontakt/mailform.php

    If you click in a field and not type anything in it and skip it, you should be able to see a msg popping up. However that doesn't seem to work with this version:

    http://testobject.cwsurf.de/kontakt.php

    Sorry about the ads, its from the free server. Just click on "SCHLIESEN" at the top right corner of the ad.

  • #13
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    135
    Thanks
    29
    Thanked 1 Time in 1 Post
    I put the wrap, <div id="mailform"></div>, after the <body> tag, which is correct right?

    So like this:
    <body>
    <div id="mailform">

    the form
    </div>
    </body>

    And this is the CSS file I added to my main with the changes:

    Code:
    #mailform *{
    	font-family: tahoma, verdana, "sans-serif";
    	margin: 0;
    	padding: 0;
    	font-size: 95%;
    } 
    
    #mailform body{
    	background: white;
    }
    
    #mailform a, a:hover{
    	text-decoration: none;
    	color: #48f;
    }
    #mailform a:hover{
    	color: #33CCFF;
    }
    
    #mailform p{
    	font-size: 90%;
    	margin-top: 1em;
    	margin-bottom: 2em;
    	color: #333;
    }
    
    #mailform h1 {
    	color: #0099CC;
    	font-size: 1.6em;
    }
    
    
    /* Form */
    #mailform form {
    	width: 400px;
    	border: 1px solid #EEE;
    	padding: 10px;
    	margin: 40px auto;
    }
    
    #mailform label {
    	display: block;
    	margin-top : 8px;
    	width: 100%;
    	background-repeat: no-repeat;
    }
    
    #mailform img {
    	border:0;
    }
    
    #mailform .blue {
    	color: #0099CC;
    	font-weight: bold;
    }
    
    /* footer */
    #mailform .dwnld {
    	Display: block;
    	padding: 10px;
    	text-align: center;
    	width: 400px;
    	margin: 0 auto;
    	border: 1px solid #EEE;
    	background-color: white;
    	color: #999;
    	font-size: 1.4em;
    	font-weight: bold;
    	line-height: 50px;
    	background: url(../images/download.gif) no-repeat 40px 10px;
    }
    
    /* footer */
    #mailform .footer {
    	Display: block;
    	padding: 10px;
    	margin: 40px auto;
    	width: 400px;
    	text-align: center;
    	border: 1px solid #EEE;
    	background-color: white;
    	color: #999;
    }
    
    #mailform .footer p {
    	color: #999;
    }
    
    /* Congratulation message */
    #mailform .MsgSent {
    	Display: block;
    	padding: 10px;
    	margin: 40px auto;
    	width: 400px;
    	text-align: center;
    	border: 1px solid #EEE;
    	background-color: white;
    }
    
    #mailform .MsgSent h1 {
    	background: url(../images/MsgSent.gif) no-repeat 0 0;
    	padding-left: 20px;
    	height: 85px;
    	line-height: 85px;
    }
    
    /* Error message */
    #mailform .MsgError {
    	Display: block;
    	padding: 10px;
    	margin: 40px auto;
    	width: 400px;
    	text-align: center;
    	border: 1px solid #EEE;
    	background-color: white;
    }
    
    #mailform .MsgError h1 {
    	background: url(../images/MsgError.gif) no-repeat 0 0;
    	padding-left: 20px;
    	height: 85px;
    	line-height: 85px;
    	color: #CC0000;
    }
    
    #mailform .MsgSent p, #mailform .MsgError p {
    	font-size: 1.3em;
    	color:#999;
    }
    
    #mailform .tipsbox .tipsbox_top_left{
    	background : url('img/top_left.png') no-repeat;
    	_background : url('img/top_left.gif') no-repeat;
    	_background-position : 9px 8px;
    }
    
    #mailform .tipsbox .tipsbox_top{
    	background : url('img/top.png') repeat-x;
    	height : 17px;
    	_background : url('img/top.gif') repeat-x;
    	_background-position : 0px 8px;
    }
    
    #mailform .tipsbox .tipsbox_top_right{
    	background : url('img/top_right.png') no-repeat;
    	_background : url('img/top_right.gif') no-repeat;
    	_background-position : 0px 8px;
    }
    
    #mailform .tipsbox .tipsbox_left{
    	background : url('img/left.png') repeat-y;
    	width : 17px;
    	_background : url('img/side.gif') repeat-y;
    	_background-position : 9px 8px;
    }
    
    #mailform .tipsbox .tipsbox_right{
    	background : url('img/right.png') repeat-y;
    	width : 22px;
    	_background : url('img/side.gif') repeat-y;
    	_width : 9px;
    }
    
    #mailform .tipsbox .tipsbox_bottom_left{
    	background : url('img/bottom_left.png');
    	_background : url('img/bottom_left.gif') no-repeat;
    	_background-position : 9px 0px;
    }
    
    #mailform .tipsbox .tipsbox_mark{
    	background : url('img/mark.png') no-repeat;
    	height : 36px;
    	_background : url('img/mark.gif') no-repeat;
    }
    
    #mailform .tipsbox .tipsbox_bottom_right{
    	background : url('img/bottom_right.png');
    	_background : url('img/bottom_right.gif') no-repeat;
    }
    
    #mailform .tipsbox .tipsbox_inner, .tipsbox .tipsbox_inner_ie6{
    	background : url('img/inner.png');
    }
    
    #mailform .tipsbox .tipsbox_inner_ie6 {
    	padding : 4px;	
    }
    
    #mailform .tipsbox .tipsbox_error {
    	background : url('img/error.png') no-repeat;
    	_background : url('img/error.gif') no-repeat;
    	width: 40px;
    	height: 40px;
    	margin-top: 5px;
    	float: left;
    	clear: left;
    }
    
    #mailform .tipsbox p, #mailform .tipsbox {
    	font-size: 1em;
    	font-family: tahoma, verdana, "sans-serif";
    	margin : 0;
    	padding : 0;
    	border : 0;
    	color : #FFF;
    }
    
    #mailform .tipsbox p {
    	padding-left: 55px;
    	line-height: 15px;
    }
    
    #mailform .tipsbox p span {
    	font-size: 1em;
    	font-weight: bold;
    	color: red;
    	line-height: 35px;
    }
    
    
    #mailform .error_f {
    	border : 1px dotted #666;
    	margin-top : 5px;
    	background-color : #EAEAEA;
    }
    
    #mailform .error_f p {
    	margin : 5px;
    	color : #A00;
    }
    
    #mailform .error_f p span {
    	font-size : 1.1em;
    	color : #000;
    	margin : 5px 0px 0px 0px;
    }
    
    /*##########################################
    Name: Default styling for Niceforms v.0.9
    Author: Lucian Slatineanu
    URL: http://www.badboy.ro/
    ##########################################*/
    
    /*Forms defaults*/
    #mailform input, textarea {
    	font-family:Arial, Helvetica, sans-serif;
    	font-size:12px;
    	color:#404040;
    }
    #mailform label {
    	color:#999;
    	cursor:pointer;
    	padding:0 0 4px 2px;
    	line-height:15px;
    	vertical-align:top;
    }
    #mailform label.chosen {
    	color:#333;
    }
    
    /*Transparent items*/
    #mailform .transparent {
    	filter:alpha(opacity=0);
    	-moz-opacity:0;
    	opacity: 0;
    	border:0px solid #FFF;
    	background:#FFF;
    	z-index:10;
    	cursor:pointer;
    }
    #mailform .transparentFake {
    	background:none;
    	border:none;
    }
    #mailform .transparent2 {
    	z-index:10;
    }
    
    /*Radio buttons*/
    #mailform .radioAreaUnchecked, #mailform .radioAreaChecked {
    	z-index:5;
    	position:absolute;
    	width:15px;
    	height:15px;
    	cursor:pointer;
    }
    #mailform .radioAreaUnchecked {
    	background:url(../../images/radio.gif) no-repeat left top;
    }
    #mailform .radioAreaChecked {
    	background:url(../../images/radio.gif) no-repeat left bottom;
    }
    
    /*Checkboxes*/
    #mailform .checkboxAreaUnchecked, #mailform .checkboxAreaChecked {
    	z-index:5;
    	position:absolute;
    	width:14px;
    	height:14px;
    	cursor:pointer;
    	border: none;
    }
    #mailform .checkboxAreaUnchecked {
    	background:url(../../images/checkbox.gif) no-repeat left top;
    }
    #mailform .checkboxAreaChecked {
    	background:url(../../images/checkbox.gif) no-repeat left bottom;
    }
    
    /*Text inputs*/
    #mailform .textinput, #mailform .textinputHovered {
    	width:236px;
    	height:15px;
    	background:url(../../images/input.gif) no-repeat left top;
    	border:none;
    	padding:4px 8px;
    }
    #mailform .textinputHovered {
    	background-position:left bottom;
    }
    
    /* Text inputs smaller */
    #mailform .textinput_small, #mailform .textinput_smallHovered {
    	width:33px;
    	height:15px;
    	background:url(../../images/input_small.gif) no-repeat left top;
    	border:none;
    	padding:4px 8px;
    }
    #mailform .textinput_smallHovered {
    	background-position:left bottom;
    }
    
    /*Text areas*/
    #mailform .textarea, .textareaHovered {
    	width:336px;
    	height:125px;
    	background:url(../../images/textarea.gif) no-repeat left top;
    	border:none;
    	padding:4px 8px;
    }
    #mailform .textareaHovered {
    	background-position:left bottom;
    }
    
    /*Selects*/
    #mailform .selectArea {
    	width:200px;
    	height:21px;
    	background:url(../../images/select_bg.gif) repeat-x left top;
    }
    #mailform .selectArea .left {
    	width:8px;
    	height:21px;
    	float:left;
    	background:url(../../images/select_left.gif) no-repeat left top;
    }
    #mailform .selectArea .right {
    	width:21px;
    	height:21px;
    	float:right;
    	background:url(../../images/select_right.gif) no-repeat left top;
    }
    #mailform .selectArea .right a {
    	display:block;
    	width:21px;
    	height:21px;
    }
    #mailform .selectArea .right i {
    	display:none;
    }
    #mailform .selectArea .center {
    	width:160px;
    	margin-left:5px;
    	margin-right:20px;
    	color:#FFF;
    	padding-top:3px;
    }
    
    /*Selects drop-down*/
    #mailform .optionsDivInvisible, #mailform .optionsDivVisible {
    	position:absolute;
    	margin-top:-1px;
    	margin-left:3px;
    	width:172px;
    	background:#6f7074;
    	padding:2px;
    	font-size:11px;
    	z-index:20;
    }
    #mailform .optionsDivInvisible {
    	display:none;
    }
    #mailform .optionsDivVisible {
    	display:block;
    }
    #mailform .optionsDivVisible p {
    	margin:0;
    	padding:0;
    }
    #mailform .optionsDivVisible a {
    	color:#F2F2F2;
    	text-decoration:none;
    	display:block;
    	padding:1px 4px;
    	border:1px solid #6f7074;
    }
    #mailform .optionsDivVisible a:hover {
    	color:#FFF;
    	background:#5F6062;
    	border-color:#cfd0d6;
    }
    
    /*Button*/
    #mailform .buttonSubmit, #mailform .buttonSubmitHovered {
    	width:69px;
    	height:26px;
    	color:#FFF;
    	font-weight:bold;
    	padding:2px 5px;
    	background:url(../../images/button.gif) no-repeat left top;
    	cursor:pointer;
    	border:none;
    }
    #mailform .buttonSubmitHovered {
    	background-position:left bottom;
    }
    
    /*Test div - testing if stylesheets are enabled*/
    #stylesheetTest {
    	position:absolute;
    	left:-999px;
    	width:10px;
    	height:10px;
    }
    Last edited by OGGordon; 11-22-2009 at 09:40 PM.

  • #14
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    my only suggestion at this time is that the ajax/jquery/mootools (whatever) used to perform the validation and the effects was relying on the classnames NOT having #mailform in front of them

  • #15
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    i think there's also some general confusion..you have two doctypes for instance

    and the

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


    doesn't exist..wrong path maybe?


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •