Jump to content

Getting a return success message or returning the data after submitting form


rad1964

Recommended Posts

Hello,

I want to test that the data that is submitted through a form is being captured. And or a succes message is sent.

Attached is the form code (grh.html), javascript (grh.js), form processing (process.php), success page (success.html).

 

Basically I am using AJAX to return the form fields that were filled out. When that didn't work, I added the success page which is also not working.

 

Any ideas?

 

 

Here is my js file contents since the uploader will not upload a .js file....

 

//AJAX - Creates the XMLHttpRequest that sends a http request to the web server
function getXMLHTTP() {
    var x = false;
    try {
        x = new XMLHttpRequest();
    }
    catch(e) {
        try {
            x = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(ex) {
            try {
                req = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch(e1) {
                x = false;
            }
        }
    }
    return x;
}

//Retrieves the Forms field values *This is a TEST for diagnostic purposes*
function displayFormValues()
{
    var str = '';
    var elem = document.getElementById('formGrh').elements;
    for(var i = 0; i < elem.length; i++)
    {
        str += "<b>Name: </b>" + elem.name + "  ";
        str += "<b>Value: </b>" + elem.value + "  ";
        str += "<br />";
    }
    document.getElementById('lblValues').innerHTML = str;
}

 

TIA,

rad1964

 

 

grh.html

process.php

successful.html

I get the javascript data being written to my initial form page (at the bottom) so it is reading the fields properly, The AJAX, does not yet play a part, please ignore that.

 

In my form tag I have an action="process.php" - what is not happening is the successful.html does not show up, which is called at the bottom of my process.php, which makes me think that the process.php is not being read...

 

Newbie here, in case you couldn't tell.

thanks,

 

rad1964

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.