Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: control in mailform

  1. #21
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    So I place this:
    Code:
    <html> 
    <head> 
    </head> 
    <body> <table style="width:350px;" valign="top"> 
    <?php 
    if ($error) 
    { 
    ?> 
    <input class="fout" type="text"......... 
    <?php 
    } 
    else 
    { 
    ?> 
    <input type="text" ........ 
    <?php 
    } 
    ?> 
    <tr><td align="left" valign="top" style="width:10px;padding-left:10px;"> 
    <script type="text/JavaScript"> 
    function clearDefault(el) { 
    if (el.defaultValue==el.value) el.value = "" 
    } 
    </script> 
    <form name="form1" method="post" action="contacttest.php"> 
    <input type="hidden" name="action" value="send"> 
    <textarea name="message" <?php if { echo 'class="fout"'; } ?>  style="border-top:0px; border-left:1px dotted #0066cc; border-right:0px; border-bottom: 1px dotted #0066cc; width:120px; height:80px" onfocus="clearDefault(this)"> your message</textarea> 
    </td><td align="left" style="width:40px;">&nbsp; 
    <td align="left" valign="top"> 
    <input type="text" name="name" <?php if { echo 'class="fout"'; } ?>  value=" your name" onfocus="clearDefault(this)" style="border-top:0px; border-left: 1px dotted #cc6600; border-right:0px; border-bottom: 1px dotted #cc6600; width:120px"> 
    <br>&nbsp;<br> 
    <input type="text" name="email" <?php if { echo 'class="fout"'; } ?>  value=" your email adress" onfocus="clearDefault(this)" style="border-top:0px; border-left: 1px dotted purple; border-right:0px; border-bottom: 1px dotted purple; width:120px;"> 
    <br>&nbsp;<br>&nbsp;<br> 
    <img src="images/vink1.gif" border="0" style="padding-left:80px;">&nbsp; <input type="submit" value="send" style="border-top:0px; border-left:0px; border-right:0px; border-bottom:0px; background-color: #ffffff;">   
    </form> 
    </td></tr></table>
    Now I don't see the trees in the bushes anymore ...

  2. #22
    Join Date
    Jul 2008
    Location
    Johannesburg, South Africa
    Posts
    31
    Thanks
    1
    Thanked 10 Times in 10 Posts

    Default

    I guess i should have mentioned then but I thought it was obvious .. the ........... in that code aren't code just I was a little lazy to type the full HTML which I thought you would realise and do instead. I was at work (and am now), so just replace those dots with the rest of the HTML required for those inputs

  3. #23
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    This is what I have now, but I have doubts about what is in red.
    I filled in one input, but what about the other ones ?

    Code:
    <?php 
    
    
    if ($_POST["action"] == "send"){ 
    
    $error = false; 
    
    if ($_POST['name'] != " your name" && strlen(trim($_POST['name'])) > 0 
    && $_POST['email'] != " your email adress" && strlen(trim($_POST['email']))> 0 
    && strlen(trim($_POST['message'])) > 0) {  
    mail ("info@site.com", "via website",  
    " 
    Name: ".$_POST['name']." 
    E-mail: ".$_POST['email']." 
    Message: ".$_POST['message']." 
    ", 
    "From: ".$_POST['name']." <".$_POST['email'].">"); 
    $subject = "your message";  
    $msg = " 
    This is an automatically sent email. Please do not reply. 
    Dear $_POST[name], 
    Thanks for your message to Ceci. 
    She will get back to you as soon as possible. 
    This was your message: 
    $_POST[message]  
    ";   
    mail($_POST[email], $subject, $msg);  
    echo ''; 
    } 
    else{ 
    $error = true; 
    } 
    } 
    
    ?> 
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    
                "http://www.w3.org/TR/html4/strict.dtd">
    
    <head>
    <title>Ceci Casariego: contact data</title>
    
    <style type="text/css">
    <!--
    div#container {
        margin:0 auto;
        background: #f2f4f7;
    }
    label {
        float: left;
        width: 140px;
        text-align: left;
        padding-top: 5px;
    }
    input, textarea {
        padding: 3px;
        margin: 3px;
        border: 1px solid #bac5d6;
        font: 10px Verdana, sans-serif;
        background: #fff;
    }
    input.fout, textarea.fout {
        border: 1px solid #FF0000;
    }
    label.fout {
        color: #FF0000;
    }
    -->
    </style>
    
    </head>
    <body>
    <div id="header-main">
    
    <div id="headercontact">
    
    <h1>Ceci CASARIEGO</h1>
    <ul>
    <li class="nav"><a href="indexGB.html">home</a></li>
    <li class="nav"><a href="portfolio.html">portfolio</a></li>
    <li class="nav"><a href="cv.html">curriculum</a></li>
    <li class="nav"><a href="news.html">news</a></li>
    <li class="nav"><a href="links.html">links</a></li>
    <li class="nav"><a href="test.html">testimonials</a></li>
    <li class="hover">contact</li>
    </ul>
    </div>
    
    </div>
    <div id="body-main">
    
    <div id="body">
    
    <div id="left">
    
    <div style="padding-top:20px; padding-bottom:17px;">
    <a href="http://artists.cecicasariego.com" target="_blank"><img src="images/linkedinlogo.gif" border="0"></a>
    </div>
    
    <ul class="sub-link">
    <li><a href="copy.html">© copyright 2004-2008</a></li>
    <li class="noimg"><a href="contactNL.html">| NL |</a></li>
    </ul>
    
    </div>
    
    <div id="right">
    <h2>Contact</h2>
    <p class="top-text">
    <img src="images/arrow1.gif" border="0">&nbsp; e-mail (alle velden zijn verplicht)
    <br>&nbsp;<br>&nbsp;<br>
    
    <?php 
    if ($error) 
    { 
    ?> 
    <input type="text" name="name" class="fout" value=" your name" onfocus="clearDefault(this)" style="border-top:0px; border-left: 1px dotted #cc6600; border-right:0px; border-bottom: 1px dotted #cc6600; width:120px"> 
    <?php 
    } 
    else 
    { 
    ?> 
    your mail has been sent
    <?php 
    } 
    ?>  
    
    <table style="width:350px;" valign="top">
    
    <tr><td align="left" valign="top" style="width:10px;padding-left:10px;">
    
    <script type="text/JavaScript"> 
    function clearDefault(el) { 
    if (el.defaultValue==el.value) el.value = "" 
    } 
    </script> 
    <form name="form1" method="post" action="contacttest.php"> 
    <input type="hidden" name="action" value="send"> 
    <textarea name="message" <?php if { echo 'class="fout"'; } ?> style="border-top:0px; border-left:1px dotted #0066cc; border-right:0px; border-bottom: 1px dotted #0066cc; width:120px; height:80px" onfocus="clearDefault(this)"> your message</textarea> 
    </td><td align="left" style="width:40px;">&nbsp; 
    <td align="left" valign="top"> 
    <input type="text" name="name" <?php if { echo 'class="fout"'; } ?> value=" your name" onfocus="clearDefault(this)" style="border-top:0px; border-left: 1px dotted #cc6600; border-right:0px; border-bottom: 1px dotted #cc6600; width:120px"> 
    <br>&nbsp;<br> 
    <input type="text" name="email" <?php if { echo 'class="fout"'; } ?> value=" your email adress" onfocus="clearDefault(this)" style="border-top:0px; border-left: 1px dotted purple; border-right:0px; border-bottom: 1px dotted purple; width:120px;"> 
    <br>&nbsp;<br>&nbsp;<br> 
    <img src="images/vink1.gif" border="0" style="padding-left:80px;">&nbsp; <input type="submit" value="send" style="border-top:0px; border-left:0px; border-right:0px; border-bottom:0px; background-color: #ffffff;">   
    </form> 
    
    </td></tr></table>
    
    </div>
    </div>
    </div>
    </body>
    </html>

Bookmarks

Posting Permissions

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