Jump to content

Help with Post redirect


bethaliz

Recommended Posts

I have a php page that needs to insert records into a database piece by piece.

 

 

We have company contacts with many branches and each branch can have many contacts. When they add a new company they need to give us the company name and address, they then select "add Branch"

 

When they select add branch the company record needs to be created in the data base, while in the SAME page an in page pop up gathers information for the branch, when they close this windo a table appears at the bottom of the page to display the branch records that go with this company.

 

Unfortunately when I enter the company record, the page is redirected. How do I get it to stay on the same page with the pages new state (ie the branch pop up being displaed)?

Link to comment
Share on other sites

use Ajax, something like this would do

 

function getFile(){ 
    var docLoad; 
    try{docLoad = new ActiveXObject('Msxml2.XMLHTTP');//IE}
    catch (e){try {docLoad = new ActiveXObject('Microsoft.XMLHTTP');}
        catch (e2){try{docLoad = new XMLHttpRequest();//MZ}
          catch (e3){docLoad = false;}}
     }
    if(docLoad !== false){
    docLoad.onreadystatechange  =function(){
         if(docLoad.readyState  ==4){
              if(docLoad.status  ==200){
                  document.getElementById('confirmdiv').innerHTML =docLoad.responseText;
		  }
              else{
                 document.getElementById('confirmdiv').innerHTML ='There was an error <strong>'+docLoad.status+'</strong>';
		  }
         }
    }; 

   docLoad.open('GET','FILE URL!!',true); 
   docLoad.send(null);
}
else{
	alert('Please either enable JavaScript or update your browser before you use this page');
}
}

Link to comment
Share on other sites

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.