Does anyone know how to send a "silent" form via a javascript handler. For example, I'd like to use an iframe that contains an html form. The iframe wouldn't be visible (parmeters=0) and the form would gather its element values subliminaly (without user input). The hang up for me is to be able to submit the form using onUnload=. I'm just not sure how to put it together, primarily because I don't have a great grasp on javascript yet.

My overall goal is to pass variables to my server from this iframe, when the page is either unloaded or closed.

Thanks,
DavidN.

    Well, obviously since they will not be filling out any fields, they are most likely going to be ip address and etc. Collect that info through php.

    Then set it up like this:

    
    $ip = $_SERVER ['REMOTE_ADDR'];
    $email = "Your email";
    $subject = "Your subject";
    $message = "Here is the stuff from the site for the user with the ip of: $ip.";
    
    //then determine if the page is unloaded. Not sure how to do it with php.
    //Then send the info through the mail() function.
    
    

      I hear ya. I just needed to do a little digging.
      I ended up collecting the data I wanted via a JS function, then, at unLoad or window.close, putting those variables in to a form and using form.submit() to automatically send the form to the appropriate .php script on my server. Of course, the variables were method="post" through the url.

      The down side is that everyone can view/source and see the client-side JS. Not to be selfish, but it is a small part of a commercial service.

      Thanks though 🙂

        Write a Reply...