Results 1 to 4 of 4

Thread: Script for 'POST e-mail' and 'thank you page'

  1. #1
    Join Date
    Jan 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Script for 'POST e-mail' and 'thank you page'

    Hi. I am pretty new to all this. I have implemented script from the following location on the dynamicdrive web site for my form. http://www.dynamicdrive.com/style/cs...eless-form/P0/

    The script contains 'css style sheet' and script for my .htm page. I just need to amend the script so that when the form is submitted an e-mail of the data is sent to me and the form gets redirected to a thank you page.

    Can some please help!!

    Thank you

    John

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Actually, there is no script on the DD library demo page that your post links to. What the form does is determined by its action and method attributes, in the demo - action is left blank and method isn't included as its default is 'get'. This is so that whatever you like may be inserted as the action and you may change the method to post as well, if it suits you. Also having an impact on what the form can do is what you have available to you on your server or from a third party as far as mail handling goes (many third party mail handlers as well as many host provided ones are free). Ideally, to get the result that you want, you would have some sort of server-side or third party mail handling software configured for use with your mail forms. Many hosts offer formail. The instructions for its use are usually also available from the hosts that provide it or they can be found on the web in various places.

    Without a web based mail handler, you could rely upon the user's mail client via scripting or simply as a mailto: reference as the action for the form but, many users do not have a mail client or, if they do it may not be configured properly for their browser or, even if they do have both of those, their javascript may not be enabled. Due to any of these possibilities, it is best to have a web based mail handler for these sorts of things.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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

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

    Default

    Previous link wasn't really what you're loooking for.

    Copy/paste the below codes, and let me know !
    PHP:

    Code:
    <?php
    
    if ($_POST["action"] == "send"){
    
    if ($_POST[name] != "your name" and $_POST[name] != "" and $_POST[email] != "your e-mail adress" and $_POST[email] != "" and $_POST[message] != "") { 
    
    mail ("me@mysite.com", "via website (EN)", 
    "
    Name: ".$_POST['name']."
    E-mail: ".$_POST['email']."
    Message: ".$_POST['message']."
    
    ",
    "From: ".$_POST['name']." <".$_POST['email'].">");
    
    $subject = "your message to (your name)"; 
    
    $msg = "
    
    Dear $_POST[name],
    
    Thanks for your message to (your name).
    She will get back to you as soon as possible.
    
    This was your message:
    $_POST[message] 
    "; 
    
    $headers = "your name"; 
    
    mail($_POST[email], $subject, $msg, $headers); 
    
    echo '<p align="center"><font color="#003366">Your message has been sent, <br>and you will receive a confirmation mail. <br> We will get back to you as soon as we can.</font></p>';
    
    }
    
    else{
    echo '<p align="center"><font color="#FF0000">Please fill in all data!<br>All fields are obligatory.</font></p><p><a href="contactENform.html">[back]</a>';
    }
    }
    ?>
    HTML:
    Code:
    <table width="100&#37;" height="100%" border="0" cellpadding="0" cellspacing="0">
    <tr><td align="center" valign="middle" style="padding-left:210px;">  
    
    <script language="JavaScript" type="text/JavaScript">
    function clearDefault(el) {
    if (el.defaultValue==el.value) el.value = ""
    }
    </script>
    
    <FORM NAME="form1" METHOD="post" ACTION="contactEN.php">
    <input type="hidden" name="action" value="send">
    <table width="100%" valign="top" align=center>
    <tr><td>
    
    <table width="160" align=left>
    <tr><td width="154" height="26" align=center background="icon/form.jpg">
    <INPUT TYPE=TEXT NAME="name" VALUE="your name" onFocus="clearDefault(this)" style="border:0px; width:148px">
    </td></tr>
    <tr><td width="154" height="26" align=center background="icon/form.jpg">
    <INPUT TYPE=TEXT NAME="email" VALUE="your e-mail adress" onFocus="clearDefault(this)" style="border:0px; width:148px">
    </td></tr></table>
    
    </td><td align=left valign=middle>
    <INPUT TYPE="image" src="icon/emailgo.jpg" NAME="submit" VALUE="go" style="border: 0px">
    </td><td style="padding-left:20px;">
    
    </td></tr></table>
    
    <table width="100%" valign="top" align=center>
    <tr><td width="250" height="120" align=center valign="middle" background="formbericht.jpg" class="focusareaback"> 
    &nbsp<TEXTAREA NAME="message" style="border:0px; width:240px; height:110px"></TEXTAREA>
    </td></tr></table>
    
    </FORM>
    
    </td></tr></table>
    Note that in this script, text is already placed into the <input> fields.

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
  •