Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: Forms - how do I get info to my email?

  1. #11
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Yep. This line is wrong.
    PHP Code:
    $email "Laura@Woodenteacher.org.uk"$_POST['email']; 
    You can't have $x = $y, $z; That's trying to assign two things to one variable, or something.
    Just pick one or the other:
    PHP Code:
    $email "Laura@Woodenteacher.org.uk";
    //OR
    $email $_POST['email']; 
    The first will send to that email, and the second will send to whatever value is sent from the form with the name "email", so a text field name="email", for example.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  2. #12
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    What BLiZZaRD *meant* to say was:
    Code:
    <?php
    $name = $_POST['name'];
    $address = $_POST['address'];
    $message = 'Address:' . "\n$address\n";
    $email = 'Laura@Woodenteacher.org.uk';
    
    mail($email, 'Prospectus Request', $message, 'From: "' . $name . '" <noreply@woodenteacher.org.uk>');
    header('Location: http://www.woodenteacher.org.uk/thankyou.html');
    ?>
    Last edited by Twey; 07-31-2006 at 07:42 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #13
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Aye, that's what I meant. LOL

    My problem with this one is that I don't really see what she wants for sure. I mean obviously an emial sent when someone fills out the form...

    But sent to who? Her? The person filling out the form? Or both? I decided both, hence including her email addy and the one submitted from the form.

    But still, the email will be pretty worthless, no real "message". All I can guess is that she wants notification and a name/email of someone who filled out a form, so she could manually email the person later with something else??

    Like wise... if that were the case, can't she just put the php send mail on the thankyoupage.html? So then it would send from the thank you page, the user would get the "echo "Thank You, your oder has been mailed to me." on the page, and skip the whole redirection thing?
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  4. #14
    Join Date
    Jun 2006
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi thanks for all the info, sorry if I haven't explained myself well.

    What I am trying to do, is if people visit the website and want a prospectus, they fill their name and address in, press the submit button. A thank you confirmation page comes up then that information (name and address) is sent to , in this case at the moment, the test site email address (Woodenteacher) which is then forwarded to me at my personal email address(eventually it will be set up at the client's email address/domain). I don't want any info sent to the person who is filling the form out.

    What is happening, now that I have added Twey's code is when I put info into the form online and click submit the thankyou.html page comes up and when I check my email, I have a message sent with Prospectus Request in the subject line, but in the body of the email it just says 'Address:' So it is kind of working, put not giving me all the details.

    Does that make sense?
    Last edited by Woody; 08-01-2006 at 06:40 AM.

  5. #15
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    That's because you should be using name not id as the identifiers for the form elements.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #16
    Join Date
    Jun 2006
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That's great Twey, I am now getting the address field sent to me but not the name?

  7. #17
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Does your form look like this:
    Code:
    <form id="myform" class="cssform" action="sendmail.php" method="post">
    
    <p>
    <label for="name">Name</label>
    <input type="text" id="name" value="" name="name" />
    </p>
    
    <p>
    <label for="address">Address:</label>
    <textarea name="address" id="address" rows="5" cols="25"></textarea>
    </p>
    
    
    <div style="margin-left: 150px;">
    <input type="submit" value="Submit" /> <input type="Reset" value="reset" />
    </div>
    
    </form>
    ?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #18
    Join Date
    Jun 2006
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Twey this is my form code:

    <form id="myform" class="cssform" action="sendmail.php" method="post">

    <p>
    <label for="user">Name</label>
    <input type="text" name="user" value="" />
    </p>

    <p>
    <label for="address">Address:</label>
    <textarea name="address" rows="5" cols="25"></textarea>
    </p>


    <div style="margin-left: 150px;">
    <input type="submit" value="Submit" /> <input type="Reset" value="Reset" />
    </div>

    </form>

  9. #19
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    That would be why then. Replace it with the code above.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #20
    Join Date
    Jun 2006
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Twey,

    That is fantastic, and has sorted it!

    Could I ask one last question, before I wrap up this thread?

    When I press submit the thankyou.html comes up, but when I close that it closes everything(the rest of the website). I guess I need a target blank code, but I'm not sure where to put it within the PHP/form code?

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
  •