Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Email form from Site

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

    Default

    Quote Originally Posted by dog
    Can anyone suggest another way of using the PHP to check the required fields have content without leaving the page?
    You could utilize javascript to check the required fields. I think there are some on this website, as well as http://dhtmlgoodies.com. If you still wanted to use the PHP to check it, and have the info saved, you could utilize setcookie(); to save the entered items in the form and when it comes back to the form.php page, the values are already in the fields.

    The second issue is more urgent but also more simple. When the form is filled out correctly, gets sent and the user arrives on form.php?send=yes and sees and echo telling the it's all good I'd also like to trigger some javascript. Can anyone suggest a trigger?
    What kind of javascript are you trying to trigger? You could do the following in form.php:

    Code:
    if ($send == "yes") {
    ?>
    
    <html>
    <head>
    <title>Message Sent</title>
    <script language="Javascript">
    /*Add JS here*/
    </script>
    </head>
    <?
    }
    
    elseif ($send == "no") {
    ?>
    
    <html>
    <head>
    <title>Message Not Sent</title>
    <script language="Javascript">
    /*Add JS here*/
    </script>
    </head>
    
    <?php
    }
    
    else {
    ?>
    
    <html>
    <head>
    <title>Send A Message</title>
    </head>
    
    <?php
    }
    
    ?>
    Hope this helps out
    "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
    Apr 2006
    Posts
    205
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Smile

    Hey man thanks for the help.

    I found a good javascript form-validator thanks to your links.

    Quote Originally Posted by thetestingsite View Post
    What kind of javascript are you trying to trigger?
    I'm trying to set a cookie. I had it working in javascript before I learnt anything about PHP so I thought it would be easier to just trigger this script.

    Now I'm thinking it might be an idea to rewrite everything in PHP because somethings gone wrong.

    Everything is behaving properly in Firefox, including your idea for triggering the javascript. But in IE it's not paying any attention to the cookies at all.

    I'll have to check that they..... DOH!!! The cookies we set to being blocked in IE. It's all working fine now.

    Man that makes me happy!

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

    Default

    Well, at least everything is working out for you. If you need any more help, let me know and I'll try to help out as much as I can.
    "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
  •