Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 33

Thread: Mail form

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

    Default

    To verify email addresses, I would use javascript. As far as the only submitting data from the textarea, simply take this line out of the php:

    Code:
    if ($_POST[name] and $_POST[email] and ...
    and just simply have this:

    Code:
    if ($_POST[textarea])
    That will only ensure that they have something in the textarea.

    And also, that test email was from me. I uploaded your code to my server, and forgot to change the $to email address. Sorry.
    "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. #12
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    To verify email addresses, I would use javascript. As far as the only submitting data from the textarea, simply take this line out of the php:


    Code:
    if ($_POST[name] and $_POST[email] and ...and just simply have this:


    Code:
    if ($_POST[textarea])That will only ensure that they have something in the textarea.
    I see what you mean, but taking it away means that I cannot force them to place name and e-mail. I need the three infos.

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

    Default

    Well one other thing you could take into consideration is in the HTML form, you have it set to have the value of "Your Name" and "Your email", and those disappear when you click on the form field. What if they don't click on it and only type in the textarea. Then you will recieve an email with

    Name: Your name
    Email: Your Email
    Message: Whatever they type in.

    To eliminate this issue, you could make the if statement I spoke of before to do the following:

    Code:
    if ($_POST[name] != "Your name" and $_POST[name] != "" and $_POST[email] != "Your email" and $_POST[email] != "" and $_POST[message] != "") {
    
    /* This will verify they have entered something in the fields other than the default values. Change as needed */
    Let me know if this helps or not.
    "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. #14
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    It works perfectly.
    Thanks a lot !!

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

    Default

    Is it possible to have a text already in the textarea as well ? (like: your message goes here)

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

    Default

    You could do it like so:

    Code:
    <textarea> Type your message here! </textarea>
    "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

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

    Default

    If I just type it, the text does not go away when I click in the textarea. It does so in the "name" and "adress". Can the same be done in textarea ?

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

    Default

    Yes, by using javascript. Not sure right off the top of my head, but give me a little while and I'll post a code snippet for you to use.
    "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. #19
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    <textarea name="info" rows="7" cols="40" onfocus="if (this.value=='Enter your text here.') {this.value='' }" onblur="if (this.value=='') {this.value='Enter your text here.'} ">Enter your text here</textarea>

    That should do it, you could probably save it in an external file, or in the head of the document (not sure how to do it exactly).
    "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

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

    Default

    There is a part of the script missing, right ? I place this in the form, but what do I place in the head ?
    Code:
    <textarea name="info" rows="7" cols="40" onfocus="if (this.value=='Enter your text here.') {this.value='' }" onblur="if (this.value=='') {this.value='Enter your text here.'} ">Enter your text here</textarea>

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
  •