Jump to content

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


Go to solution Solved by 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

  • Solution

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.