Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 33

Thread: Mail form

  1. #21
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Code:
    onfocus="if (this.value=='Enter your text here.') {this.value='' }"
    this part clears the data if there is the defualt text in it and

    Code:
    onblur="if (this.value=='') {this.value='Enter your text here.'}"
    this part returns the default text if there was nothing entered in the textarea. Like I said in my previous post, you could put it in the head of the html but I'm not sure how you would do it.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

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

    Default

    Thanks, I figured it out.
    Another question: what do I need to add in the php code, to have a customized confirmation mail being sent to the adress filled in the form ?

  3. #23
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    simply add another mail(); to the script, but instead of putting in your email address for the to field, use the variable for what they entered. change the subject, and the message if you would like as well.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

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

    Default

    Really big thanks for all your help and explanations, but you are talking to a rookie. Can you show me the codes with explanations, please ?

  5. #25
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    As you have in your php script

    PHP Code:
    mail (
    "info@casariegoart.com",
    "via website (EN)",
    "
    Name:     "
    .$_POST['name']."
    E-mail:   "
    .$_POST['email']."
    Message:  "
    .$_POST['message']."

    "
    ,
    "From: ".$_POST['name']." <".$_POST['email'].">"); 
    just simply add another one somewhere else in the script. So it will look almost like the following:

    PHP Code:

    $to1 
    "me@mydomain.com"//your email address
    $to2 $_REQUEST["email"]; //the email address entered in the form

    $subject1 "Form mail script"//subject for the email going to you
    $subject2 "Thank you for submitting the form"/*subject for the confirmation email*/

    $message1 "This is the message you will recieve."//self-explained
    $message2 "This is the message going to the person who submitted the form"//self-explained

    $headers "From: My Website <noreply@mydomain.com>";

    mail($to1$subject1$message1$headers); //this one goes to you
    mail($to2$subject2$message2$headers); //this one goes to the other person. 
    Hope this kinda explains it. If not let me know and I'll try to incorporate it with the script you already have set up.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

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

    Default

    Thanks a lot. I placed the codes together, with a few questions in it. Could you check them please, and correct them where needed ?

    Code:
    <?
    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 (
    "info@casariegoart.com",
    "via website (EN)",
    "
    Name:     ".$_POST['name']."
    E-mail:   ".$_POST['email']."
    Message:  ".$_POST['message']."
    
    ",
    "From: ".$_POST['name']." <".$_POST['email'].">");
    
    echo '<p align="center"><font color="#003366">Thanks !<br>Your message has been sent.<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="contactEN.html">[back]</a>';
    
    $to1 = "info@casariegoart.com"; 
    $to2 = $_REQUEST["email"]; 
    
    $subject1 = "message via website";  
    $subject2 = "Thank you for submitting the form"; 
    
    $message1 = "This is the message you will recieve."; // here I place nothing ?
    $message2 = "This is the message going to the person who submitted the form"; // so here I place the customized text ?
    
    $headers = "From: My Website <noreply@mydomain.com>"; //what is headers ?
    mail($to1, $subject1, $message1, $headers); 
    mail($to2, $subject2, $message2, $headers); 
    
    }
    }
    ?>

  7. #27
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    The example i posted for you was just that, an example; but you have got the idea. The headers is the thing in the email that tells you who and where the email was sent from. Usually this is done automatically, but if you wanted to edit the headers yourself then use this, otherwise you can take it out (it is optional).
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  8. #28
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    After looking over the code a little closer, I noticed a few things out of order. Below is the modified code as to how it should look.

    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] != "") { 

    //send the info submitted in the form

    mail ("info@casariegoart.com""via website (EN)"
    "
    Name:     "
    .$_POST['name']."
    E-mail:   "
    .$_POST['email']."
    Message:  "
    .$_POST['message']."

    "
    ,
    "From: ".$_POST['name']." <".$_POST['email'].">");

    //assign the simple variables
    $subject "Your message was recieved!"//subject for confirmation email

    $msg "Thank you for submitting your data to us. A rep will contact you as soon as possible. Blahblahblahblah"//confirmation email message.

    $headers "From: Casariegoart.com <info@casariegoart.com>"
    /*who the message is being sent from */

    //send the confirmation to the user
    mail($_POST[email], $subject$msg$headers); 

    echo 
    '<p align="center"><font color="#003366">Thanks !<br>Your message has been sent, and you have been sent a confimarion email as a "reciept". <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="contactEN.html">[back]</a>';
    }
    }
    ?>
    That should do it.
    Last edited by thetestingsite; 12-01-2006 at 04:44 PM.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

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

    Default

    Works perfectly. Thanks a lot ! Just two more questions, and then I guess I'll leave you alone.
    - how can I add <html> in this sentence (like <br>)?
    $msg = "Thank you for submitting your data to us. A rep will contact you as soon as possible. Blahblahblahblah"; //confirmation email message.
    - how can I place a copy of the sent mail into the confirmation mail (unther the above text) ?

  10. #30
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    well you could try something like this, but keep in mind that some email clients do not support HTML emails; however, most of them do.

    Code:
    $msg = <<<HERE
    
    This will be the message of the email. <BR>
    You <font color="red">should</font> have recieved this &amp; that. <BR><HR><BR>
    The message you submitted was the following:<BR>
    Name: $_POST[name] <BR>
    E-mail: $_POST[email] <BR>
    Message: $_POST[message] 
    <BR><HR><BR>
    
    Thank you,<BR>
    Blah blah!!!
    
    HERE;
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

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
  •